German schools also ruthlessly cull students beginning in grade 4 or 5. Only a small number ever get the opportunity to go to university at all, let alone at those fees.
German universities are relatively cheap because they keep the eligibility pool small. That reduces the cost to the state.
> Only a small number ever get the opportunity to go to university at all
In 2022, 56.4% of people living in Germany of a yearly cohort started university (including universities of higher education/Fachhochschule). 51.7% of males, 61.5% of females. 473,665 people (this number includes some foreign students, though) out of a population of aprox. 84 million. All in all, 2,915,700 people studied in Germany. I would not call that number "small".
The student quotient for the US is somewhat higher, but German and foreign systems are often not well comparable, because there are a lot of advanced vocational training programs in Germany outside of university that are equivalent or even better than many university programs in other countries.
German universities are relatively cheap because they keep the eligibility pool small. That reduces the cost to the state.