Two years later, when Joseph was around 30, Pharaoh started having recurring nightmares. In one, there were seven fat cows, but then seven skinny cows showed up and ate the fat ones. In the other, seven ears of ripe grain were devoured by seven ears of blighted grain. These dreams disturbed him so much that he called all the court magicians–you know, his priest, his doctor, his psychiatrist–to ask them what it all meant, but alas, none could give a satisfying answer.
So as Pharaoh sat drowning his sorrows in wine and complaining about how crappy his magicians were, his cupbearer suddenly remembered Joseph, and told Pharaoh all about the Hebrew prisoner who interpreted dreams so well. Pharaoh demanded that someone track down this Joseph in the dungeon, then to bathe and delouse him and bring him before Pharaoh.
When Joseph, newly scrubbed and clothed, was standing before the throne, Pharaoh told him his dreams. Joseph told Pharaoh that both dreams meant the same thing. That there was going to be seven years of plenty followed by seven years of drought and famine. Then Joseph was all, here’s what you should do, Pharaoh. You should appoint someone as tax collector to confiscate 1/5 of all the agricultural products every year for the next seven years and warehouse it. That way when the seven lean years come, not only will you not starve, you will be able to sell it all back to your people and others and make bank.
Pharaoh was all, I like this idea and I think you should be the guy in charge of it. That way if it doesn’t work, I’ll just put you back in the dungeon where you came from. Guards, find this man some nice clothes and a domicile suitable for a court official, and oh, hey, Potiphar priest of On, don’t you have an unmarried daughter? Well not anymore! Clean her up and send her on to my new right hand man Joseph.
So Joseph became the most powerful man in Egypt, and ruthlessly taxed people 1/5 of all their produce (i.e. wealth) from the richest to the poorest.
During this time, Joseph had two sons.
Then when the drought and famine started, Joseph started selling all that warehoused food back to the people, which kept them from starving and also made Pharaoh a tidy profit. Eventually, people from other lands heard that there was food for sell in Egypt and started travelling there to buy it.