I personally don't think there is that much of a difference. In the end you are risking your money to gain money. I think the people who say differently problem won some cash from the market and assume its safe, it isn't.
I think you understood share market invest wrongly that's why you're saying both are same. In actual case share market investment is nothing but your investing in certain business and expecting them to do better job and give you profits but gambling is just based on pure luck. In gambling either you win or lose all your money instantly but in share market you will not lose instantly all your money.