I think it's both a cause of and a symptom of the middle class disappearing.
Part of the compulsion towards gambling and lotteries is this sense that there's no other viable path upwards from where you are.
If you can't even imagine a reasonable chance of success from starting a small business, finding a better job, going back to school, or some other healthy path towards security and prosperity, then literally rolling the dice starts to seem like the most tangible (if unlikely) path towards wealth.
People gamble when they believe they don't have any better opportunities to spend their meager amount of discretionary income on.
(Of course, there is a separate compulsion towards gambling that is more a direct mental illness like alcoholism. But if you see a large-scale rise in gambling, I think you need to look for societal causes.)
And there are notoriously betting groups around the world that have made fortunes off of betting on horse racing. I'd bet that they feel superior to people betting on commodities and productive assets when they could be betting on horses.