In the closing daf of Massekhet Menaḥot, the Gemara discusses the state of Diaspora Jewry and quotes a passage from Sefer Malakhi (1:11) where the prophet discusses how God’s Name is known throughout the world, where “pure offerings” are presented to Him in all places.
The “pure offering” mentioned is interpreted by the Gemara as referring metaphorically to a man who first marries and then studies Torah. Since he is married, he is not disturbed by sinful thoughts.
Tosafot point out that this teaching is, in fact, the subject of some discussion in Massekhet Kiddushin 29b. There we find an apparent disagreement on this matter. Rav Yehuda quotes Shmuel as ruling that a person should first get married, and can study Torah later; Rabbi Yoḥanan objects, arguing, “reḥayim be-tzavaro ve-ya’asok ba-Torah!? With a millstone – i.e. the responsibilities of supporting a family – on his neck, how can he study Torah!?” He concludes that a person should study Torah first and get married afterwards.
The Gemara concludes that there is really no disagreement between Rav Yehuda and Rabbi Yoḥanan – ha lan ve-ha lehu – we must recognize the differences between the communities in Bavel and Israel. What the Gemara does not explain is which ruling is appropriate for which community and why that would be the case.
Rashi explains Shmuel’s ruling as applying to students from Bavel who traveled to Israel to study. Since they were not at home, they were not responsible for supporting their families, and could marry first. Rabbi Yoḥanan was talking to Israeli students who remained at home and could not divest themselves of their responsibilities. They were, therefore, encouraged to study first and marry later.
Tosafot do not accept Rashi’s explanation. They are disturbed by the idea that a man can choose to abandon his family in order to travel to a foreign land and study. Furthermore, the ruling that encouraged marriage before study was made at least partially to allow a man to learn Torah while having satisfied his natural sexual urges; if he leaves his wife behind in Bavel, this is not accomplished. Rabbeinu Tam suggests that Rabbi Yoḥanan was telling the poor students of Bavel that they should come to Israel for study before they take on the responsibilities of a family, while Shmuel was telling the wealthy Israeli students that they could marry, since they would remain at home during their studies.
Some rishonim follow Rashi’s approach, but with a different explanation. In Bavel tradition allowed young women to work and support the family, so students who made such an arrangement could first marry. In Israel, where the entire responsibility of support was on the husband, students were told to first learn Torah and to marry later.