When I was in school, the soda machine was in the closely guarded janitor's lounge. But we could still bring it from home if we wanted.
There are no vending machines in my daughter's school and carbonated beverages are not permitted, even brought from home. I think it is more because of the shaken/exploding can/bottle factor than anything else.