The military has been a bonanza for defense contractors for years. Now it is turning into one for tamer companies as well.

Operating on the premise that soldiers don't live on guns alone but buy a lot of butter, too, many corporations have started looking more hungrily toward the ranks of the uniformed, realizing that beyond the M-16s and B-52s, beyond the regulation khakis and dog tags, there's a lucrative consumer market equally ripe for conquest -- provided, of course, that you can cut through the ubiquitous red tape.

In fact, the military is a marketer's dream. It's young, it's affluent and it's family-oriented -- all of which added up to $8.3 billion in sales of consumer goods last year.

"It's an absolutely great market to go after," said William Lazarus, director of the American Logistics Association, the trade group that represents the diaper markers, aspirin manufacturers and producers of other consumer goods sold to the military. "The potential is tremendous," Lazarus added.

Just consider these numbers:

The average income for activeduty families is $20,148, comfortably above the national average.

Roughly four out of every five males on active duty fall in the prime 18-34 age market compared with less than one out of two for the population as a whole.

About two-thirds of active duty military personnel are married.

There are 7.8 million potential customers in the military, or 4 percent of the shopping population -- and they never have to worry about a recession.

Little wonder major corporations have been clamoring for a piece of this protected market. But the clamoring hasn't been without its wheezes and coughs.Like everything else in government -- only more so -- the military has its own way of doing things that makes selling to it -- whether guns or butter -- something of a unique experience.

"They set up certain barriers," said Mike Tewey, sales manager for Healthtex, a large children's wear firm which recently entered the military market. "They have their own standards on size and quality. They even wanted to inspect our factories before we could sell to them. They also have their own packaging and marking requirements and their own payment schedules," Tewey added.

Others have complained of costly inefficiencies resulting from antiquated inventory practices, excessive bureau-cratic fussiness and poor management because soliders who serve as store managers have no profit incentives.

Also, because the U.S. military is spread around the world, setting up supply lines to it frequently becomes a major logistics nightmare for private companies. Large firms with expansive sales forces can cope, but smaller firms must rely on brokers who specialize in this sort of thing.

Despite these lumps, lags and middlemen, company managers say the military market is worth the extra effort for one reason: It pays.

Consumer goods get funnelled into the military through two types of stores -- commissaries, which are the military equivalent of supermarkets, and exchanges, which resemble department stores. Both tend to carry fewer items then their civilian counterparts -- and yet still outsell them. The key to the military store's attractiveness: tremendous volume.

Commissaries alone chalked up more than $3 billion in sales in 1977, which put them in seventh place in the U.S. supermarket rankings. The average commissary did nearly $10 million worth of sales a year, more than twice the average Safeway. Meantime, exchanges enjoyed the same same sales fever, scoring $4.4 billion last year and pushing them to seventh in the department store listings.

This large sales volume is critical. By law, consumer goods companies must sell their products to the military at no greater price than they sell to anyone else. What they lose in profit margins by selling to the military, they make up for in high turnover.

Some consumer items naturally do better than others. Two outstanding examples are cigarettess and liquor, which the average military family buys more of than does the average civilian family. The cigarette consumption of domestic military personnel is 93 percent higher than the U.S. average. For overseas military, it is 169 percent higher. The numbers are similar for alcoholic beverages.

This kind of sales power has prompted many companies to realize the military is a market they cannot afford to overlook. A number of large corporations have established separate military sales groups. And they have reserved advertising funds for messages targeted specifically at the Armed Forces.

Such growing interest in military advertising has spawned an assortment of special publications, including Ladycom for the military wife, Family for the military family, Off Duty and R&R for military on vacation, and AFN TV Guide for military TV viewers.

In addition, many consumer goods firms run promotions especially for the military. The displays in exchanges and commissaries can be far more flamboyant than anything in the civilian market. Last fall, for instance, Seagram's sponsored a dog tag promotion. For $2 and the label from a bottle of Seagram's liquor, a soldier could get a copy of his dog tag. In two months, the company sold 72,000 tags.