Before the brothers cast Yosef into the pit, they refer to him in a derogatory manner as the Baal Hahalomot, the Master of Dreams. When they propose to sell him into slavery, they say, now we shall see what will become of his dreams. After all in his dreams Yosef had seen himself as the ruler, now that he was cast down and sold into slavery, it would seem that only in his dreams would he ever rule.
But what are dreams anyway? There are two ways of looking at dreams. Dreams can be the most important thing in your life, the thing you dream about. Or dreams can be absolutely meaningless, vaporous dreamstuff, the chaotic spray of the subconscious. What sets one apart from the other and gives a dream meaning? The source and root of the dream itself.
How then does Yosef rise to power and rule? It is because of his dreams, as the Baal Halomot that his brothers mockingly called him, he is raised out of the pit to interpret Pharaoh's dream. Yet what is it that gives Yosef the ability to interpret the dream that all the wise men in Egypt lacked?
Common sense alone would suggest the interpretation that Pharaoh's dream referred to something involving food or agriculture, the common denominator between grain and cows. Healthy stalks and cows suggest prosperity and unhealthy ones suggest famine. It doesn't seem that Yosef accomplished anything special and it's hard to see why all the wise men in Egypt couldn't think of something as simple as this.
The answer though lies at the root of the dream. Why did this dream worry Pharaoh so much in the first place, so much so that he went to such frantic measures to get an interpretation and why did he remain dissatisfied with all the interpretations that he was given? Clearly Pharaoh wanted a different answer than the one he was being given, not just a difference in interpretation, but a substantial difference in worldview.
We see that difference on display when Pharaoh calls Yosef forward and says וַאֲנִי, שָׁמַעְתִּי עָלֶיךָ לֵאמֹר, תִּשְׁמַע חֲלוֹם, לִפְתֹּר אֹתוֹ, I heard that it is said about you that you can hear a dream and interpret it. This is Yosef's chance to boast about his abilities as the Master of Dreams, yet he replies, אֱלֹהִים, יַעֲנֶה אֶת-שְׁלוֹם פַּרְעֹה, G-d will answer to give Pharaoh peace.
And indeed Yosef's interpretation is half interpretation and half prophetic advice. Rather than simply telling Pharaoh the bare meaning of his dream, Yosef instead tells him what to do about it. From the beginning Yosef informs Pharaoh that his dream is no mere dream, אֵת אֲשֶׁר הָאֱלֹהִים עֹשֶׂה, הִגִּיד לְפַרְעֹה, What G-d is about to do he tells Pharaoh.
The wise men of Egypt could no doubt hit on the right interpretation and probably did, but their interpretation could not ease Pharaoh's mind, because what they could not do is get to the root of the dream as Yosef did. Yosef's brothers dismissed his dreams as his own egotistical plot against them. The wise men of Egypt too treated Pharaoh's dream as originating from him, only Yosef could truly interpret it because only he understood that it originated from G-d as his own dreams had. This was what truly made Yosef, the Baal Hahalomot, the Master of Dreams, because he remained aware of the true source of those dreams.
When Pharaoh dreamed he saw himself standing over the river Nile and what he saw was unnatural and impossible, weak cows devouring strong cows and poverty devouring plenty. Pharaoh had envisioned himself as a god and yet when confronted with such things, he found himself inadequate and forced to look for an answer from G-d and so when he retold the dream to Yosef, he placed himself not above the river, but on the riverbank.
Pharaoh's need for an answer came in two parts, first he wished to understand what the dream meant and secondly how such an inversion of natural law could occur. Yosef answered both questions by telling him that the dream was first of all a message from G-d and that G-d possessed the ability to invert natural law, so that the weak could devour the strong. In reply Pharaoh too inverted the usual order of things by making a slave the second most powerful man in Egypt, recognizing that the will of G-d overturns the natural order of things.
The root of the dreams of these two men, of Yosef and of Pharaoh, of the slave in the dungeon and the ruler of the world's mightiest nation, was the same. This was the lesson that Yosef taught to Pharaoh, that the truth of true dreams lies not with the ego of the individual, but with the Creator of the World. In slavery and privation, Yosef put aside his own dreams and now he put them on again as the viceroy of an empire, the Master of Dreams had become the Master of Egypt, in the blink of an eye the slavery had come to dominate Egypt. It was a lesson that Egypt forgot and would learn again when the dream of a nation of slaves begun with but a single word from Yosef, "Pakod, Yifkod", "G-d Shall Remember You" would lead to freedom and the overturning of Egypt and another Pharaoh's rule for then as now the true Master of Dreams is G-d.
(To see what I wrote about Parshas Miketz previously, see One Dream, One People, One G-d )