When Hashem was destroying Sedom, Lot was the only resident who was saved. This is seen in Bereishit 19:29: “And Hashem remembered Avraham, and saved Lot from the upheaval of Sedom.”
How did Lot merit to be saved? Rashi explains that since Lot did not expose Avraham when, as Avraham entered Mitzrayim, he said that Sarah was his sister, Lot was saved here.
This explanation is particularly troubling to Rabbi Yisrael Salanter. Rabbi Salanter asks: Why was Lot saved for keeping his mouth shut; was it not greater that he practiced Hachnasat Orchim?
Rav Salanter answers that Lot’s Hachnasat Orchim was only performed since he had seen Avraham do it. Silence in Egypt, on the other hand, was Lot’s own decision and action.
The Beit Haleivi adds that Lot’s hospitality was not enough, because he had only done it for Malachim. Avraham, on the other hand, did it for Anashim, even though he did not know they were prestigious.
We can extract two ideas from this: first, that it is profoundly important not to betray a friend to an evil authority, and second, Hachnasat Orchim should be done regardless of the status of the guest.