Funding the public education system is a good thing and a similar system exists in California: https://www.calottery.com/who-benefits
However OPs point about mostly lower socioeconomic groups funding the lottery is still relevant as it raises questions about whether this pseudo-regressive “tax” is a fair way to fund a public good like education.