Schools are trying to optimize the number of students in class because they get paid based on in-class participation.
They actually optimize how many students they graduate. That is why they want the student count high and the standards low.
Exactly. The state funding per school depends on the number of students.
Salaries and pensions for teachers and hangers-on is the purpose of public schools.