The Mishnah in Pirkei Avot 4:5 records the statement that one shouldn’t make Torah study into something for worldly benefit. I was curious then, how do the haredim that do full time Torah study en masse like in many yeshivas and kollels in Israel reconcile this with their attitude that full time Torah study can be a job en masse for Jewish communities? This statement seems like it’s Saying the opposite, Torah study isn’t something to make worldly benefit from (ie mass stipends, or Tzedakah from working donors) and in it’s not something to make living with.
The Ramba"m, based on this mishna (Avos 4:5), paskened that learning without working, and relying on tzedaka is not allowed (Hilchos Talmud Torah 3:10):
כל המשים על ליבו שיעסוק בתורה ולא יעשה מלאכה, ויתפרנס מן הצדקה – הרי זה חילל את השם, וביזה את התורה, וכיבה מאור הדת, וגרם רעה לעצמו, ונטל חייו מן העולם הבא; לפי שאסור ליהנות בדברי תורה בעולם הזה...
Anyone who decides to learn Torah and not work, and get payed from charity, has desecrated HaShem's name, shamed the Torah, put out the light of the religion, caused bad to himself, removed his life from the world to come; because it is prohibited to use the Torah for his own worldly enjoyment...
In the Rambam's explanation of the Mishna in Avos (4:5) he brings multiple proofs from all over Shas for what he holds, though he mentions that many chachamim won't agree with him.
The Kesef Mishna, on the quoted Ramba"m, gives a very lengthy explanation of why the Ramba"m's proofs aren't proofs, and brings his own proofs from Shas that the Ramba"m is wrong. I won't quote him, but he explains the mishna in Pirkei Avos in the following way
Do not make them as a crown to make yourself great, or as a shovel to dig with. Meaning, although Rabbi Yishmael said earlier that if one learns in order to teach (i.e. to gain respect as a Rosh Yeshiva, or to treat it as a job, like a professor), he will be provided for with enough to learn and to teach, Rabbi Tzadok says that these ideals are Assur.
Therefore, per the Kesef Mishna, the Mishna in Avos is only teaching us that it is prohibited to learn for the purpose of making money. But, the Kesef Mishna continues, learning for a good purpose, and being payed to do so (assuming he doesn't have the money to support himself), is allowed. And he says that they must fulfill one of three conditions:
They teach children, and are being paid to do so as 'babysitters' (as schmerel mentioned)
They are being paid to learn so they can provide guidance for the community, which would otherwise be lacking
Being paid to judge.
In conclusion, the Kesef Mishna posits that what the Ramba"m means is that one should not rely completely on charity. Rather he should learn a profession, and then if that is not enough to support himself while also teaching Torah (or whatever position he has), he may rely on charity.
He also brings another explanation, being that even if Me'ikar Hadin one shouldn't rely on charity while learning, since "עת לעשות להשם הפרו תורתיך" - A time to act for HaShem, the Torah is nullified. In other words, if we didn't have people who would learn Torah and not work, the Torah would be forgotten Ch"V.
The Ba"ch says that Rashi, Rabbeinu Tam, the Tashbe"tz and the Aruch all argued with the Ramba"m, though the Tur agreed with him. The Abarbanel also disagrees with the Rambam.
Some of the claims made, as to why it is allowed nowadays (in addition to the ones already quoted):
It is no longer a Chillul HaShem not to work; rather, it is considered more respectable to learn than to work. (Tashbetz chelek 1:142)
If Talmidei Chachamim work, they will not be given the respect that they need in order to teach Torah and have the congregation listen (Tashbetz 1:148)
They are not getting payed to learn or teach, they are getting paid שכר ביטולן - 'unemployment wages', which is allowed (even the Ramba"m agrees that in such a case it's allowed).
The Ma'ase Roke'ach claims that nowadays even the Ramba"m would admit that it's allowed, because otherwise the torah would be lost.
Rav Moshe Feinstein (Yoreh De'ah B 116) wrote in the conclusion of his teshuva:
דין ברור ופשוט שנתקבל בכל הדורות אם מדינא [=שכר בטלה דמוכח], אם מתקנה ד"עת לעשות לה' הפרו תורתך", שמותר לעסוק בתורה ולהתפרנס מקבלת פרס או ממה שהוא מלמד תורה לאחרים או שהוא רב ומורה הוראה, ואין להמנע מזה אפילו ממדת חסידות.
It is a clear and simple rule that was accepted throughout the generations, whether because of the letter of the law (that it's unemployment wages, as was proven), or because of the rule of 'a time to act for HaShem, the Torah is nullified', one is allowed fo learn Torah and be paid by sponsor, or by teaching others, or by beign a Rabbi or a posek, and one shouldn't stay away from this, even as a Middas Chassidus (beyond the letter of the law).
So, in short, the Ramba"m says that it's not allowed, and some Rishonim and Achronim agree with him. Many other Rishonim and Achronim disagree, for various reasons, and explain the Mishna in Avos, as well as all other proofs, in various ways (as brought in the Kesef Mishna, or because it's no longer applicable because עת לעשות להשם). The general consensus is: it's allowed, especially if he is planning on learning in order to fill a position that is/ will be needed in the community (Rabbi, teacher, Posek, etc.)
This question would be more of a question on rabbis than those who are learn in kollel. Those who are learning in kollel and are being supported are closer to making a Yissocher-Zevulan deal (an agreement where one person learns and the other person supports him and they split the reward in the next world) than they are to making money off learning.
As far as rabbis are concerned, technically they are indeed not allowed to be paid for teaching Torah. They are paid in the (case of elementary school rebbeim) for watching children and in the case of an adult rabbi or teacher for the fact that their preoccupation with teaching and other rabbinic functions does not allow them to have time to earn a living.
In all cases it is correct that Torah is not (or at least should not be) a "business" with an intrinsic profit motive. The type of person who is successful as a rabbi is usually talented enough that he could be making a lot more money were he to devote himself to a career.
The above is assuming one may never make get paid for learning. The Chasam Sofer (שו"ת חתם סופר חלק חושן משפט סימן קס"ד) and Rav Moshe Feinstein (שו"ת אגרות משה יו"ד חלק ב' סימן קט"ז) writes that because the Torah will be lost unless people will get paid to learn one may do so in todays times. The Mishnah Berurah, in Biur Halacha (אורח חיים סימן רל"א בד"ה בכל), notes that under certain conditions, even the Rambam despite his general strong opposition to doing do would agree that one may get paid for learning Torah.