Genesis 47:21

And as for the people, he removed them to cities from one end of the borders of Egypt even to the other end thereof.

The relocation to cities from one end of Egypt's borders to the other took place during the famine after the Egyptians had given up their land and themselves to Pharaoh in exchange for food. It was an act of wise administration that kept Egypt supplied with food through the famine and greatly enriched the kingdom. The Israelites stood apart from this arrangement, for they had not sold their land or themselves, but were granted land to dwell in on account of the service rendered to Egypt. Joseph's father and his brothers were free from taxation and were sustained with food by his provision.