Well, to using some gambling/probability terms, stocks, bonds, and CD's are all +EV (expected value). Stocks are more +EV but also high variance; down to CD's which are lower EV but low variance. You could draw a graph with data points for CD's up to leveraged real estate. Each data point would have a higher EV and a higher variance (risk), so you could draw a line showing the positive correlation between the two variables. The line, in investing terms, is known as the efficient frontier.
However lottery tickets are both high variance and -EV. So if you put it on that graph, it would be well off the line. Thus, it is a bad investment.
That's not a great way to look at it. Stock options have an EV=0 yet they can be used either for speculation or as insurance. When used as insurance they reduce risk. They fall closely on the efficient frontier to lottery tickets. But that does not make options a bad investment.
Personally I don't play the lottery and I do not consider it an investment in any sense of the word. But I have seen various analyses of the lottery that look beyond just EV that make an academic case for lotteries.
For example, it is common in academic literature to focus on expected value as the rational way to make decisions. It is also known that humans do not make decisions based on expected value. We tend to focus on the risk side. Risk aversion is given a greater weight than reward-seeking. This behavior has been observed and documented consistently across a wide range of decision environments.
In the context of investing, this means that if you make decisions based on expected value when you are playing the game with a bunch of other people that are using different criteria, you might not be as smart as you thought. The trouble is that this behavior is hard to quantify. But it explains many characteristics of markets including the formation and collapse of bubbles. (Differing perceptions of risk lead to different behaviors even though the objective situation (EV) remains the same.)
In the context of the lottery, the risk is always $1. The expected value might be -0.5 but the situation is so asymmetric that people will play. And it is not necessarily a bad decision when considered under an alternate version of decision theory that is based more on reality than the expected value approach.