It seems hard for a lottery to actually make a loss!
I did some googling and then Illinois lottery did make a loss in 2015 due to increased advertising spend: https://www.chicagobusiness.com/article/20150917/NEWS02/1509...
Apart from that I don't see any evidence for your claims. Do you have a link?
They don't, it's a scam. Other than that the fact that money is fungible (so sending lottery money to schools really doesn't mean anything), when you crack open the books (which is never done, and there are always contracts that include never doing it), they don't make money. In Illinois, which has always had a huge lottery, it never even broke even. Lotteries are just one of the many vehicles for politician self-dealing.