I work at an elementary school and we can’t (not that we want to) sell soda and candy. Lunches are crap because they follow federal student lunch guidelines, which follow federal nutrition guidelines. Low fat, low salt, calorie-restricted with plenty of carbs.
Back in the dark ages when I started teaching, schools had kitchens and the lunch ladies made actual food (not low carb, but fresh cooked food like mom would make). Then the federal government decided the needed more involvement and mandated all school lunches have precise numbers of this and that with severe limits on fat and salt. It became hard to cook fresh food, but lookie… processed food manufacturers stepped in to fill the void with frozen, packaged stuff with all the ‘counts’ right on the box.
No school (that I have seen) built since the 90s even has a real kitchen. Just giant warming ovens they can warm the plastic-wrapped trays that come from the central ‘kitchen.’
High schools have snack bars and do things differently, but in elementary school at least we are not selling anything but the government-mandated junk.