The gemara says that originally only one who had a father to teach was able to learn because they darshened ולמדתם אותם את בניהם - ולמדתם אתם. Meaning, the father himself it obligated to teach his son, and no one else is obligated to teach the children of others. But, R' Yehoshua Ben Gamla made multiple takanos creating a Yeshiva system which was not just the responsibility of the parents to pay for, but became a community responsibility. The gemara tells us that the parameters of this takana was: 1. There should be a yeshiva for children to learn in every city so that even 6 and 7 year olds can attend and so that the kids don't need to travel far. 2. The members of the city are responsible to support it, and they are even responsible to allow it to occur in their courtyard despite the noise. 3. The teacher student ratio should be 1:25, no more that 25 kids per class.
The Shulchan Aruch of the Ba'al Hatanya (talmud torah 1:3) points out that based on the takana of r' yehoshua ben gamla the tuition responsibility should really be on the community, but the minhag became that parents pay for their child unless they cannot afford it. The responsibility of the shortfall falls equally on both those who have young children and those who don't. He explains that the custom nowadays for parents to pay for their own children doesn't undermine the takana, rather they are mochel their rights to demand community funds. But, those who cannot afford to pay, have a right to request and demand a community collection for this purpose. However, the Ba'al Hatanya points out:
אך אין לכופם אלא לשכור מלמד אחד לכ"ה תינוקות כבימיהם, וילמדם מקרא לבד, כל התנ"ך פעמים רבות כבימיהם וכו'ואם אותם שאין ידם משגת רוצים ללמד לבניהם משנה וגמרא שלא די במלמד אחד או אפילו שנים לכ"ה תינוקות, יפרעו המותר משלהם
The Ba'al Hatanya assumes that the takana of R' Yehoshua ben Gamla was only for tanach, but not for mishna and gemara. He deduces this from the language of the gemara - סך מקרי דרדקי which implies that they only taught mikrah. In the kuntros acharon he explains that since one is technically not allowed to charge for mishna and gemara, one can only charge for mikra as the gemara explains in nedarim 37 that the charge is for pisuk ta'amim or babysitting. Therefore, the entire takana was only to force the community to pay for what the melamed was allowed to charge for. Based on this, nowadays when they are teaching torah sh'bal peh, it is not the responsibility of the community to pay for it. Furthermore, the age of the child which would fall under the communal responsibility depends on the rationale for charging. According to the opinion who says that you can charge for pisuk ta'ami would require the community to pay even for older children, whereas the rationale of "sechar shemira" would only require the community to pay for children that are very young to still require babysitting. It seems to me that the gemara seems to contradict this, becasue the gemara assumes that 16 and 17 year olds were originally the only ones who took advantage of this takana, until it was extended to 6 and 7 year olds. This implies that even teenagers where included in the takana and are the communities responsibility.
B'kitzur, the community is not responsible to pay for the shortfall of the entire yeshiva. They are only required to pay for the shortfall based on the cost of teaching torah sh'biksav at a 1:25 teacher to student ratio. But, based on my understanding of the gemara, it will include even older grades, which is against the Shulchan Aruch HaGraz.
FOR A DISCUSSION OF YOREID L'TOCH U'MNASO SHEL CHAVEIRO - click here