Example of REAL Highschool rules in Japan
Looks a lot less relaxed than in manga.
I taught in a similar school - rural, but sought after and our students went to the good universities after graduation. I would say reality is more relaxed than the rules would indicate. Also, I would say the students didn't mind as much as you might think. With everyone constantly stressing over The Test (and in our students' case, they'd had at least one The Test before - to get into our school - and possibly another - to get into a good middle school), it's nice to also have school rules and pride and old-fashionedness. That says you're going to a good school, not just a Test-Passing Factory.
As far as I know, our students mostly didn't go straight home, since they actually had quite a commute. If you had totally banned "hanging out after school" it would have been like banning having friends. It's not like urban areas where you have endless trains. Our students were polite, well-dressed, and obedient, but if they needed a part-time job, they wouldn't have gotten into any trouble. You all know we had school on Saturdays, right? But actually, that's the best day of the school week - about a half day and that's when the students get a lot of socializing in.