ומדינים כבריח ארמון אח נפשע מקרית עוז זה לוט שפירש מאברהם ומדינים כבריח ארמון שהטיל מדינים כבריחין וארמון (דברים כג, ד) לא יבא עמוני ומואבי בקהל ה'
and their contentions are like the bars of a castle” (Proverbs 18:19)? “A brother offended is harder to be won than a strong city,” this is Lot, called Abraham’s brother (see Genesis 14:14), who separated from Abraham. “And their contentions are like the bars of a castle,” this is because Lot brought contention between the Jewish people and his own descendants like bars, which lock the gates of a castle. Just as no one can enter a locked castle, so too Lot’s descendants, Ammon and Moab, were prevented from joining the Jewish people, as it states: “An Ammonite and a Moabite shall not enter into the assembly of the Lord” (Deuteronomy 23:4).
דרש רבא ואיתימא רבי יצחק מאי דכתיב (משלי יח, א) לתאוה יבקש נפרד ובכל תושיה יתגלע לתאוה יבקש נפרד זה לוט ובכל תושיה יתגלע שנתגלה קלונו בבתי כנסיות ובבתי מדרשות דתנן עמוני ומואבי אסורין ואיסורן איסור עולם
On the same issue, Rava expounded a verse homiletically, and some say it was Rabbi Yitzḥak: What is the meaning of that which is written: “He who separates himself seeks his own desire, and snarls against all sound wisdom” (Proverbs 18:1)? “He who separates himself seeks his own desire,” this is Lot, who separated from Abraham. “And snarls [yitgala] against all sound wisdom,” this too describes Lot, as his shame was eventually revealed [nitgala] in the synagogues, when his actions recorded in the Torah are read in public, and in the study halls, where the halakhot of his descendants are taught. As we learned in a mishna: An Ammonite and a Moabite are prohibited from entering the congregation by marrying a Jewish woman, and their prohibition is permanent.
אמר עולא תמר זינתה זמרי זינה
§ In relation to the preceding discussion with regard to the daughters of Lot, who acted in a wanton manner for the sake of a mitzva, the Gemara cites that which Ulla said: Tamar engaged in licentious sexual intercourse with her father-in-law, Judah (see Genesis, chapter 38), and Zimri ben Salu also engaged in licentious sexual intercourse with a Midianite woman (see Numbers, chapter 25).
תמר זינתה יצאו ממנה מלכים ונביאים זמרי זינה נפלו עליו כמה רבבות מישראל
Yet despite the similarity between their actions, Tamar engaged in licentious sexual intercourse for the sake of a mitzva, to have children, and therefore she merited that kings of the House of David descended from her. King David’s lineage traces back to Tamar’s son Peretz (see Ruth 4:18–22). And she also merited to be the ancestor of prophets, e.g., Isaiah, who was related to the royal family. Conversely, with regard to Zimri, who engaged in licentious sexual intercourse for the purpose of a transgression, several multitudes of Israel fell due to him; twenty-four thousand in a plague (see Numbers 25:9). This shows that a great deal depends on one’s intentions.
אמר ר"נ בר יצחק גדולה עבירה לשמה ממצוה שלא לשמה והאמר רב יהודה אמר רב לעולם יעסוק אדם בתורה ובמצות אפי' שלא לשמן שמתוך שלא לשמן בא לשמן
§ Rav Naḥman bar Yitzḥak said: Greater is a transgression committed for its own sake, i.e., for the sake of Heaven, than a mitzva performed not for its own sake. The Gemara questions this comparison: But didn’t Rav Yehuda say that Rav said: A person should always occupy himself with Torah and mitzvot even not for their own sake, as it is through acts performed not for their own sake that good deeds for their own sake come about? How, then, can any transgression be considered greater than a mitzva not for the sake of Heaven?
אלא אימא כמצוה שלא לשמה דכתיב (שופטים ה, כד) תבורך מנשים יעל אשת חבר הקני מנשים באהל תבורך מאן נשים שבאהל שרה רבקה רחל ולאה
Rather, one must emend the above statement and say as follows: A transgression for the sake of Heaven is equivalent to a mitzva not for its own sake. The proof is as it is written: “Blessed above women shall Yael be, the wife of Hever the Kenite, above women in the tent she shall be blessed” (Judges 5:24), and it is taught: Who are these “women in the tent?” They are Sarah, Rebecca, Rachel, and Leah. Yael’s forbidden intercourse with Sisera for the sake of Heaven is compared to the sexual intercourse in which the Matriarchs engaged.
א"ר יוחנן שבע בעילות בעל אותו רשע באותה שעה שנאמר (שופטים ה, כז) בין רגליה כרע נפל שכב וגו'
The Gemara asks: How is it derived that Yael engaged in sexual intercourse with Sisera? As Rabbi Yoḥanan said: That wicked one, Sisera, engaged in seven acts of sexual intercourse with Yael at that time, as it is stated: “Between her feet he sunk, he fell, he lay; between her feet he sunk, he fell; where he sunk, there he fell down dead” (Judges 5:27). Each mention of falling is referring to another act of intercourse.
והא קא מתהניא מבעילה דיליה א"ר יוחנן כל טובתן של רשעים אינה אלא רעה אצל צדיקים
The Gemara asks: But Yael at least enjoyed the sexual intercourse with him; why is the verse so effusive in her praise? Rabbi Yoḥanan said: All the good of the wicked, i.e., anything good received from wicked people, is nothing other than evil for the righteous, and therefore she certainly derived no pleasure from the act.
שנאמר (בראשית לא, כט) השמר לך מדבר עם יעקב מטוב ועד רע בשלמא רע שפיר אלא טוב אמאי לא אלא לאו ש"מ טובתו רעה היא ש"מ:
The Gemara asks: From where is this principle derived? As it is stated in the verse that God warned Laban the Aramean, when he was chasing Jacob: “Guard yourself from speaking to Jacob, from good to evil” (Genesis 31:24). Granted, with regard to the warning against speaking evil, it is fine that Laban was warned not to harm Jacob. However, why shouldn’t he say anything good to Jacob? Rather, must one not conclude from this verse that even Laban’s good is bad in Jacob’s eyes? The Gemara concludes: Learn from this that it is so.
גופא אמר רב יהודה אמר רב לעולם יעסוק אדם בתורה ובמצות אפי' שלא לשמן שמתוך שלא לשמן בא לשמן שבשכר מ"ב קרבנות שהקריב בלק הרשע זכה ויצאה ממנו רות וא"ר יוסי בר' חנינא רות בת בנו של עגלון מלך מואב היתה
§ The Gemara returns to analyze in greater detail the above matter itself. Rav Yehuda said that Rav said: A person should always occupy himself with Torah and mitzvot even not for their own sake, as through these acts performed not for their own sake, good deeds for their own sake come about. The proof for this is that in reward for the forty-two offerings that the wicked Balak sacrificed (see Numbers, chapter 23), although he did not do so for the sake of Heaven but to facilitate the cursing of the Jewish people, nevertheless he merited that Ruth descended from him. Not only was he the forebear of a righteous convert, but also of King David. And this is as Rabbi Yosei, son of Rabbi Ḥanina, said: Ruth was the daughter of the son of Eglon, king of Moab, who descended from Balak, king of Moab.
א"ר חייא בר אבא א"ר יוחנן מנין שאין הקב"ה מקפח אפי' שכר שיחה נאה דאילו בכירה דקריתיה מואב א"ל רחמנא (דברים ב, ט) אל תצר את מואב ואל תתגר בם מלחמה מלחמה הוא דלא אבל צעורי צערינן
Rabbi Ḥiyya bar Abba said that Rabbi Yoḥanan said: From where is it derived that the Holy One, Blessed be He, does not deprive one of even the reward for proper speech, i.e., for speaking in a refined manner? As while there is the case of Lot’s elder daughter, who called her son Moab [mo’av], which alludes to his shameful origins, as me’av means: From father, and the Merciful One says to Moses: “Do not besiege Moab, nor contend with them in war” (Deuteronomy 2:9), which indicates: It is war that is not permitted; however, with regard to harassing, the Jews were permitted to harass them.
ואילו צעירה דקריתיה בן עמי אמר ליה (דברים ב, יט) אל תצורם ואל תתגר בם אפילו צעורי לא תצערינן כלל
And while there is the case of Lot’s younger daughter, who called her son Ben-Ami, son of my people, without explicitly mentioning her father. With regard to her descendants, God said to Moses: “Do not harass them, nor contend with them” (Deuteronomy 2:19), which means even as far as harassing is concerned, you may not harass them at all.
א"ר חייא בר אבין א"ר יהושע בן קרחה לעולם יקדים אדם לדבר מצוה שבשכר לילה אחת שקדמתה בכירה לצעירה
Rabbi Ḥiyya bar Avin said that Rabbi Yehoshua ben Korḥa said: A person should always come first with regard to a matter of a mitzva, as in reward of the one night that the elder daughter of Lot preceded the younger for the sake of a mitzva,