Granted, retail investors lose more often than they win - but there’s no incentive of the market that ensures this - merely asymmetry of information. In contrast, commercial gambling can _only_ work if the house always wins.
This isn’t belied by peer-to-peer gambling (save for non-commercial instances, like a poker game among friends), since in these cases the facilitator will take an exorbitant cut.
Moreover, the stock market serves an ethically legitimate purpose - the efficient allocation of capital. Not so gambling.