You couldn't be more wrong. This is both the reason why it isn't technically gambling and the reason it isn't nearly as dangerous as gambling. This is virtual gambling and it's nowhere near as novel or outrageous as people in here would have you believe.
The very fact that you can win real money is a large part of the attraction to gambling.
The psychological aspects are the same though. Gambling is not addictive because you win money, gambling is addictive because of the psychological rush you get from it. And all games of chance (including lootboxes and GTAV casino) have this aspect.
I mean, I'm not sure on what basis it would be illegal.
Best I can tell, this isn't that different from other MTX. Unlike loot boxes, players know exactly what they're getting with their money. I guess an argument could half-heartedly be made that it then falls to them to leverage it well to make an in-game payday, but the said could be said about a ton of other MTX, that players who aren't skilled at the game don't leverage what they purchase as well.
Laws don't worry about the art assets or gameplay elements something is wrapped in.
On the basis that it's a perdatory practice that is based on abusing psychological weaknesess to make money. This is socially hurtfull and thus there is a reason for this to become illegal (or rather - strongly regulated).
I mean, it's not that gambling is illegal in most countries. It's perfectly legal. It's just hard to get into, and that's why game devs and publishers avoid falling into gambling regulations. It's not that "surprise mechanics" are illegal. They just have to comply, and that makes it:
a) costly
b) harder to abuse people