I'm a school administrator, and I can shed some light on the dietary changes from when we were kids.
Often, a beverage/candy company will "sponsor" a school, giving them a piece of the proceeds from all beverages sold from their machines. Some see this as a cash cow, and it has been for a while. Now the pendulum is swinging the other way towards healthier choices for our children.
As far as fund-raising foods for clubs and such, it is a different issue. The companies that the schools contract with to provide meals to students often have a slim margin to profit. Increasingly, they are seeing fund-raising and school store foods cannibalizing some of their potential lunchtime sales. Some believe that the schools sanctioning such sales is a violation of their contract. I know in our district, unless the food vendor is involved (aside from our High School's vocational restaurant) food cannot be sold on school grounds. The vendor wants all $2 that Billy's mom gives him in the morning. Hard to blame them, really.