Actually, in ways it is. (in loco parentis)
This is a dumb idea from a policy standpoint, but it's certainly within a school's power to decide what sort of food can be consumed inside it.
Just because you can do something doesn't mean you should though.
Governments have the power and it's always been true. Having the ability to make people do things however doesn't make them right, it often makes them bullies.
I would certainly say that this is something which shouldn't be done. Assuming for the moment this is intended to be beneficial it's still a problem because it's another form of "zero tolerance", which I abhor. In my case when we sent our children to school their meals were at least as good if not better than what they were served at their schools. Generally the quality of their cafeterias are good, and probably better than Chicago schools from what I've been able to determine. Why should I accept that if my child were in this situation that he or she would have to eat inferior food? Oh yes I understand that this is intended to mitigate poor nutrition, but it does so taking the lowest common denominator and applying it to everyone. It removes the option for parents who do act responsibly to give there kids something more appealing than nutritious crap.
It is a case of the government using it's power without sufficient input from the community. That's my chief objection, the usurpation of the people's rights, and yes that's what putting such policies into place without the community having any say is. I'm not a fan of autocrats, which the system effectively allows the principle to be in this case.