(Genesis 19:1:) "And Lot was sitting at the gate of Sodom." It is written "sat." There were five judges in Sodom, and Lot was worse than all of them, yet they seated him among them, for thus it is written: "And Lot sat at the gate of Sodom." (Proverbs 22:6:) "Train up a child in the way he should go." Because he had grown up in the house of Abraham and had seen him receiving those who came and went, he learned from him. Therefore he brought the angels in to himself. What is written there? "Before they lay down" etc. (Genesis 19:4). The angels began to wonder, saying: Has the matter reached even as far as us? Lot said to the angels: What have you come here to do? They said to him: "For we are destroying" (Genesis 19:13) — they revealed to him their mistarin (meaning: their secret). For this reason they were banished from their precinct for a hundred and thirty-eight years. Rabbi Tanchuma said: a hundred and thirty years, like the numerical value of "ladder" (sulam) in gematria.
Lot the Judge of Sodom and the Angels' Revealed Secret
Midrash Tanchuma Buber, Vayera 21:4
ולוט יושב בשער סדום (בראשית יט א). ישב כתיב, חמשה דיינים היו בסדום, ולוט רע מכולם והושיבוהו ביניהם, שכך כתיב ולוט ישב בשער סדום. חנוך לנער על פי דרכו (משלי כב ו), לפי שגדל בביתו של אברהם וראהו מקבל עוברים ושבים למד ממנו, לפיכך הכניס המלאכים אצלו, מה כתיב שם טרם ישכבו וגו' (בראשית יט ד), התחילו המלאכים תמהים לומר עד אצלינו הגיע את הדבר, אמר לוט למלאכים מה באתם לעשות כאן, אמרו לו כי משחיתים אנחנו (שם יג), גילו לו מסטירין (פי' סתר) שלהם, לפיכך נדחו ממחיצתן קל"ח שנה, ר' תנחומא אמר ק"ל שנה, כמנין סלם בגימטריא.