In a sense, Genesis 12 foreshadows the Exodus. After Abram got Sarai to agree to lie about her relationship with him, they entered Egypt. As expected, she is taken into Pharaoh’s palace, and as expected:
12:16 – It went well for Abram. He gained flocks and cattle, male and female servants, donkeys, and camels.
God strikes Pharaoh and his people, and then at the end of the chapter:
12:20 – Pharaoh commanded his men concerning Abram, and they sent him out with his wife and all his possessions.
Through human compromise and sin and because of the broken world — famine, in this case — the people of God go down to Egypt, and through trickery, they plunder the Egyptians.