That depends if the prize is large enough then the pot odds are such it does make sense to bet on the lottery.
2. Don't compare to letting the money sit under a matress. Insteaad, compare with other investments.
Buying a lottery ticket doesn't make sense when measured purely in terms of profit, even when the expected profit is non-negative.