In essence, it may fell the same, but take a closer look: it may have big differences.
When you gamble or bet, unlike investing, most of times you can earn or loose money more quickly.
When you invest by the other hand, you often have more sources of information to mitigate your losses.
But take a basic example:
Let's play roulette game!
(Winner winner, chicken for dinner!)
Let's follow basic math here.
Suppose, on first round you bet 10 bucks on red.
Ball stops on black. What a bad luck.
Next round, you bet once again on red, but this time you double it, 20 bucks.
Now, your odds to win, instead of 50% (not counting green) are about 75% (that is, based on statistics, if the roulette is not a scam..., If you keep following the math, chances of loosing are halved every spin...)...
This time you luckly you win! Congratulations, you made 10 positive bucks!
This logic can also be applied for other games, like dice high or low, and maybe even black jack!