I got an A in probability theory last semester, yet I occasionally play the lottery. I end up spending approximately 20 dollars per year on lottery tickets for the "big jackpot" games. In my budget book, I put that down in the "entertainment" category. It satisfies an emotional itch, it has nothing to do with being bad at math.
I spend a lot more money on Keno at bars, around 200 per year. But once again, this isn't due to poor math skills. I understand that for every dollar I spend, my expected value is 67 cents. I do it for the social aspect and to satisfy that emotional itch.
There are some people who play the lottery because they believe in "magical thinking." They believe that because they had a dream about a lottery number, that number will hit and they need to play it. Or if they saw a specific number on two different license plates that day, they should play that number. This isn't being bad at math, this is just being bad at reality.
Then there are people completely without hope in their lives that play the lottery. They reason that even if they save up every penny they spend on the lottery, they'll STILL be poor and unable to ever retire. Let's take somebody who makes 1500 a month at age 50, with no savings. Let's say they spend 5 dollars a day on lottery tickets, which ends up being 150 per month. Let's furthermore assume they never hit anything for simplicity. If they had instead saved that 150 per month, they'd have an extra 1800 per year. By the time they're 70 years old, they would have been able to save up a grand total of 32,000 (assume they invest their money in something that exactly keeps up with inflation, so it's 32000 in "real dollars"), which enough to support them approximately 2 years in retirement. Since these people have no hope to retire, they are looking for any way "out" they can. No matter how unlikely hitting the lottery is, they feel that the odds of getting out of poverty through hard work and sacrifice is even less likely.
To simply say it's a "tax on people who are bad at math" misses the reasons people play the lottery.