Schools and educators in Japan play a much bigger role in kids' lives than they do in the West. We're used to teachers' responsibility to their students pretty much ending the minute the kids leave school. But in Japan, the school takes over a kid's life to a far larger extent, and a teacher is responsible for a huge number of things that fall to parents in other countries. They often conduct home visits,
Say, for example, a kid gets in trouble for shoplifting. In the States, the police, and then the parents would get called. However, in Japan, the police MIGHT get called, but after that the next call would be to the kid's school. The homeroom teacher would come to apologize on the kid's behalf. And then the school would call in the kid's parent(s) for a conference.
Students who wear a certain school's uniform are regarded as representing their school to the outside world. Therefore, most schools really impress upon their students that they have a duty to behave well outside, as emissaries of their school. And as high schools are very competitive and take their institutional reputations very strongly, that can mean a lot of pressure for those kids to stay in line. Many of them worked really hard to get into that school, after all.
And so, yes, some schools do ban their students from having part-time jobs. The school wants the kid to study, and take part in school clubs and sports teams. If they get a job at McDonalds or something, suddenly that job becomes their identity, not being a student, and as far as the school is concerned that can only be a bad thing.
Many students who need/want extra spending money do try to get around that rule. In a big city like Tokyo, it's easy to just try and blend into the crowd. But, as has happened in many school life anime over the years, it only takes one person recognizing you to blow your cover.
There are lots of subtle differences between Western and Japanese schools, but this is one that actually goes well beyond school walls.