The Midrash has a story that many of the commentaries use as their answer, and it’s interesting. It has to do with Lot’s position in the family.
When Lot joins Abram out of Haran, one of the first adventures is the ordeal in Egypt. Abram tells Sarai to lie about their relationship to avoid being killed by Pharaoh.
Suppose Abram was killed. Who would have benefited in that situation? Who would be the heir to the Promised Land? The rabbis say it was Lot.
The opportunity for Lot to demonstrate his character is there in Genesis 12. If Lot speaks up and says “no, they’re married,” Abram would die and Lot would gain everything.
Therefore, Lot’s righteousness is demonstrated by his silence. He chose to protect his uncle and forgo the financial benefit.