Words of comfort
ועתה אל-תעצבו ואל-יחר בעיניכם כי-מכרתם אתי הנה כי למחיה שלחני אלקים לפניכם
Now, don’t be upset or feel guilty that you sold me, since G-d sent me [to Egypt] before you as a salvation [from the famine]
After Yosef revealed to his brothers that not only was he alive, but he had become the viceroy in Egypt, they were taken aback. They couldn’t find the words to respond. Yosef sensed they felt guilty for selling him as a slave twenty-two years earlier. To make them feel more at ease during this long-awaited reunion, he offered them words of comfort. In reality, their act of selling him was for a blessing. The known world had been plagued by a famine for already two years. Only Egypt had food to survive, as Yosef had made the necessary preparations after he properly interpreted Pharaoh’s prophetic dream. He succeeded in securing enough food for the nation to last through the seven year-long famine. Yaakov and his family had managed to survive this long with their savings, but they had run out of food. Only because Yosef was sent to Egypt was there salvation from starvation. Therefore, the brothers shouldn’t feel guilty for selling him. However, upon further inspection these words of comfort seem to be superficial.
The gemarra relates that the verse which says, “The ways of Hashem are straight; righteous people walk in them and transgressors stumble in them” refers to Lot and his two daughters. After the city of Sedom was destroyed, Lot and his two daughters were the sole survivors. His daughters thought they were the only human beings left on Earth, and felt it was their duty to repopulate the world. Their intentions were for the sake of Heaven; therefore, they are considered to have walked in the ways of Hashem. However, Lot’s intentions were to fulfill his lusts. How do we know this? We know from earlier that Lot was a lustful man, as that was his motivation to move the city of Sedom. Consequently, Chazal tell us we can assume that is what his intentions were here too. Therefore, while Lot and his daughters were involved in the same act, regarding him he is considered a transgressor stumbling in the ways of Hashem. According to this, we should be able to say the same thing regarding Yaakov’s sons selling Yosef. Although their act fulfilled the Divine plan, Yosef was able to save his family from the famine, this wasn’t their intention. The brothers didn’t know this would end up happening; they simply intended to sell him as a slave. However, we can’t consider the sons of Yaakov to be sinners. There must be some resolution to this problem.
To answer this, we must first investigate this idea that a good act with bad intentions makes a person considered a transgressor who stumbles in the ways of Hashem. We are taught that if a poor person benefits from a coin that was unintentionally dropped, the one who dropped it is considered as if they had given it directly. We see that even though this person didn’t intend to do any mitzvah, it’s looked at favorably. Why isn’t Lot’s unintended mitzvah considered meritorious? One could in fact differentiate between the two. There, the person didn’t intend to do anything; neither a mitzvah or a transgression. This is unlike Lot, whose main intention was to do commit a lewd act. Even though in the end because of him his daughters were able to accomplish a mitzvah, he’s looked at like a transgressor. However, we do see another case where a person intended to commit a sin, and it’s looked at favorably. King David and the story with Bas-Sheva is on the surface sketchy, yet Chazal teach us that he wasn’t suitable for such a sin. Rather, it was Divinely engineered to teach the masses the power of repentance. Seemingly David did not have this in mind when he was with Bas-Sheva. We should then say the same with Lot. Despite his bad intentions, it was engineered that a mitzvah would be fulfilled through him.
We therefore need to make the following distinction: the conclusion of the story should prove its beginning. The intimacy between Lot and his daughters bore them the nations of Amon and Moav. Regarding them, the prophet says: “their pregnancies did not follow their thoughts”. Since in the end their children are considered illegitimate, we would then have to say that this act was not Divinely influenced. All we have then is his bad intentions, despite the mitzvah that he caused. Therefore, he is called a transgressor. However, by Bas-Sheva, the result of that relationship produced King Shlomo and began the lineage of Moshiach. This great conclusion shows that the beginning of their relationship was Divinely engineered. It was done to teach the masses how to repent.
This then was the comfort that Yosef offered his brothers when he saw that they looked guilty and depressed. There already was a decree from Heaven that the Jews should be exiled to Egypt. Therefore, Chazal teach us that Yaakov really should have been dragged to Egypt in chains, as the common method of enforcing exile is through chains. However, Yaakov’s merits saved him from this debasement. Nevertheless, this severity of exile somehow had to be fulfilled. It ended up being fulfilled through Yosef being sold to Egypt as a slave. When he told his brothers not to worry about selling him, he meant that they weren’t suitable for such a transgression. Rather, it was Divinely orchestrated to occur, so this severity of exile would be fulfilled in some way. The proof of this is that Yosef was placed in a position of power, second in command to Pharaoh. Through this he was not only able to provide for his family, but ensure that his father was brought to Egypt with dignity and honor.
 Based on Chasam Sofer’s Toras Moshe II to Genesis 45:5
 Translation from The Living Torah by Rabbi Aryeh Kaplan
 Genesis loc. cit.
 Nazir 23a
 Hosea 14:10
 Genesis 19:30
 Ibid verse 31 with Rashi, citing Bereishis Rabbah 51:8
 Genesis 13:10
 Nazir loc. cit.
 Rashi ad. loc.
 See Meshech Chochmah to Genesis 37:26 who says this is the connection between Yehudah’s deceit of his father and his suspicious act with Tamar, pointed out in Sotah 10b. Both had bad intentions but good results
 Sifrei Devarim 283:6, paraphrased by Rashi to Deuteronomy 23:19
 II Samuel Chapter 11
 Genesis 19:37,38
 Isaiah 16:6
 Rashi ad. loc.
 Malbim ad. loc.
 The Chasam Sofer goes as far as to say they are mamzerim, which makes sense since it was an incestuous relationship. However, this doesn’t fit well with the lineage of King David coming from Moav
 The original text says Tamar, but this must be a typo
 Not from that original act but from their eventual marriage
 Genesis 15:13
 Shabbos 89b
 Rashi to ad. loc.
 To satisfy Hashem’s middas hadin, attribute of Justice
 This is alluded to by Yosef saying, “Elokim sent me to Egypt”, which refers to Hashem’s middas hadin
 I don’t quite understand why the Chasam Sofer needed to add this extra part. Simply say that since in the end Yosef was able to provide them food, that proves that the sale was Divinely orchestrated