Earlier quoted context omitted.
Investing is putting money into (hopefully) productive use, like a company with revenue, in an expectation of a return. Gambling is basically redistributing money according to a random numbers generator, It's a negative sum game (because the house takes its fee), but a surprise positive spike game. That spike forms an addiction in the less fortunate.
When you buy a stock, you're not contributing it to the company's productive use. If I buy $1000 of MSFT, Microsoft doesn't get an extra $1000 in their bank account to invest in their business. That $1000 is going to another bettor to settle his previous bet, and at some point in the future, I'll sell and get an unknown amount of money to settle my bet. Just because historically betting on the stock market has been +…
MSFT goes up a tiny fraction when you buy. That means MSFT employees with stock grants get a tiny "raise" courtesy of you and with no cost to the company. Microsoft can also use their more expensive stock to make acquisitions. So you are contributing to the company's productive use in at least 2 ways if you buy its stock.
Buying MSFT doesn't meet the criteria to be called gambling, for me.