In many cases, they are not. I have seen stories posted on this forum of government school essenpolizei searching kids' lunches and forcibly taking anything that doesn't meet their arbitrary "standards".
I can see that this is a great opportunity for the entrepreneurial types in the student body to make money smuggling in candy bars and selling them. Just imagine - kids who would normally just be smoking in the boys' room, wolfing down doubles of Snickers bars in between classes.
This would freak the school control freaks out completely, and they'd overreact trying to arrest the little sugar freaks, and no doubt adopt a "zero tolerance" program to suppress it.
The "Good Kids" in school would stop trying to sneak in candy bars, and sooner or later the kids would only be able to obtain their contraband candy would be from the drug dealers, who always seem to find a way to get their product past the vice principal and the hall monitors.