The short answer is that ancient Egypt was VERY rich. ‘Egypt, Canaan and Israel in Ancient Times’ by Donald B. Redford (Princeton,1993) can serve as a re-orientation of point-of-view (if you are willing to read some dense material), from what is presented in biblical narratives. Egypt was a superpower in the ancient world from earliest documented times, ca. 3000 BCE, and rivalled mainly by Mesopotamian cultures, like Assyria and Babylon. The annual flooding of the Nile gave Egypt a reliable agricultural surplus, which was much less subject to vagaries in the weather than Canaan and elsewhere. Access to local mineral wealth, and trade routes to more distant regions, both around the Mediterranean and across the Red Sea and Indian Ocean, and overland, (one reason Egypt was continually involved in the Levant), created additional wealth. If you have ever seen the Cecil B. DeMille “Ten Commandments” from the 1950’s.