Software engineers for example are easily capable of reliably earning six figures in the US, outside of the Bay Area. With stock compensation their earnings potential is that much higher. It's a solid multi-millionaire track if you grind away at that career path and keep your expenses in line.
So why bother with the lottery in that case? Because a few million dollars isn't enough?
If you're earning $40,000 per year with an inability to generate much in the way of savings (compared to the software engineer), your job prospects are highly capped, you do manual labor in a factory in a 2nd tier city, your education level is weak, and your shot at a multi-millionaire outcome is essentially zero, maybe giving up 5% of your savings makes sense for a shot at an epic outcome to escape that lower middle class trap.