The nation's stock exchanges like to describe the often frantic buying and selling that takes place on their trading floors as investment. Sometimes they might even allow that part of it may be speculation. But out-and-out gambling? - never.

There are meanwhile the jaundiced observors who have always insisted that the only difference between the stock market and a gambling casino is that in the market you don't get paid off in chips.

And given the excesses of the "Atlantic City market" of the last few months, where any issue even remotely or mistakenly associated with casino gambling has shot up in price, the distinction becomes harder and harder to draw.

Companies have only to mention that they are thinking about opening a casino at some vague point in the future and their stock jumps a few points. Or, like Wurlitzer - the juke box company which some speculators thought might venture into slot machines - it can issue a denial and its stock still spurts.

Resorts International, the only company with an actual operating casino in Atlantic City, has seen its elass "B" stock go up 600 percent since the beginning of the year. And Bally, the slot-machine manufacturer, has quadrupled in price on the hopes that legalized gambling may soon become a nationwide phenomenon as states seek new revenue sources to counter a tax-payer revolt.

Throughout this speculative mania, the stock exchanges have largely kept their eyes averted, either due to squeamishness about gambling taint or an unwillingness to be the spoil-sport at the party. After all, the markets haven't had a binge like this since the go-go 60s. And there was hope that the situation would calm down on its own.

But instead of blowing off, the speculation became even more feverish in August.

Last Friday, after a number of brokerage firms felt the situation had gotten out of hand and issued strong warnings to their customers to stay away or sell their casino shares, the New York and American stock exchanges finally moved to increase margin requirements from 50 to 75 percent on a handful of particuarly volatile gambling-ralated stocks.

The increase in margins significantly increased the amount of cash a customer has to put up to invest in these issues, but falls short of the 100 percent requirement imposed by A. G. Becker securities last Thursday.

And while the higher margins created an initial setback for the casino group, it only lasted a day as gambling issues came back strongly following the extended Labor Day weekend.

The situation is a difficult one for the stock exchanges. How much should individuals be protected from their own speculative instincts, as long as the risks in a situation are fully disclosed?

At the same time, anyone familiar with the great speculative bubbles of the past knows that sooner or later they all burst. And those investors who come in at the tail-end can get devastated. When that happens, the fall-out could affect the market as a whole and not just gambling stocks.

"What we don't want is another boom-bust cycle, especially in gambling stocks," said one official at a major retail brokerage firm who asked not to be indentified." What concerns those of us who have been the bubble burst so often is that retail customer is often left holding the bag. Some of these stocks are selling at 40 to 60 times earnings, which is unbelievable, there's been little research done on these companies because no Wall Street house wants a big speculative binge pinned on them, so there's an absence of good information.

Ironically, the most thorough piece of research on the subject was issued in mid-August by Harold Vogel, entertainment analyst for Merrill, Lynch, Pierce, Fenner & Smith - the country's largest brokers - and the report was widely circulated as the legitimate underpinnings to the speculative fever.

Loaded with cautionary caveats, the report did raise the prospect that a series of states faced with proposition 13-like taxpayers revolts could legalize casinos and turn gambling into a 1980s growth industry.

But it also cautioned that 'shelter-skelter investment in just any company because it has a casino or is planning to open a casino is risky and is inadvisable."

Despite the warnings, the effect of the report turned out to be so bullish that Merrill Lynch last week issued another wire to "reemphasize the need for caution."

The stock exchanges are meanwhile still faced with the question of what to do if this bubble keeps growing, and face charges that they acted belatedly and could have nipped this thing in the bud earlier in the year.

"if in fact the volatility continues, we would consider to going to 100 percent," said Robert Hall, NYSE executive vice president. 'If there are people who want to speculate, it's perfectly all right from our standpoint. But if it goes too far, we want to make sure that everybody is playing with all of their money up front."

Hall said that it was not until last week that the NYSE's own surveillance standards were violated for long enough to warrant the call for higher margins. "It is easy in hindsight to say we could have acted earlier, but it is a judgment call," he said.

Frank Savarese, assistant vice president at the AMEX for market surveillance, noted that his exchange had earlier imposed higher margins for resorts international shares. As for the other casino shares on the Amex, "Anybody could argue that we could have or should have moved earlier, but hindsight is 20-20 vision," said Savarese.

At this point, however, it is going to take some foresight to minimize the damage when this bubble burst.