What was the immediate purpose of Yoseph being privy to the dreams of his fellow prisoners?
Why is one dream about plants and the other about processed foods?
Why was the wine steward reinstated and the baker slain?
Soon thereafter the Egyptian king’s wine steward and the baker offended their master, who was the king of Egypt.
— Bereishis 40:1
 [Regarding] this one (the wine steward) a fly was found in his goblet, and [concerning] that one (the baker) a pebble was found in his bread. (Bereishis  Rabbah 88:2)
— Rashi ibid
The wine steward told his dream to Yoseph, “in my dream†he said, “there was a grape vine right in front of me and in the vine there were three shoots; and as soon as it began budding, its blossoms flowered, and its clusters matured into ripe grapes … I took the grapes and squeezed them into Pharaoh’s chalice and placed the chalice into the palm of Pharaoh’s hand.â€
— Bereishis 40:9-11
When the chief baker saw that the interpretation was good, he said to Yoseph: ‘I also saw myself in my dream and there were three baskets of fine white bread on my head; and in the topmost basket there were of all kinds of baked goods for Pharaoh [to eat] but birds were eating from the basket on my head.
— Bereishis 40:16,17
Rabban Gamaliel sat and taught, “Woman is destined to give birth every day, for it is said, ‘the woman conceived and gave birth all together (Yirmiyahu 31:7).’†A particular disciple mocked him quoting, “there is no new thing under the sun (Koheles 1:9).†Rabban Gamaliel replied â€Come, and I will show you its simile in this world [currently under the sun]â€. He went out and showed him a hen [hatching her daily egg]. On another occasion Rabban Gamaliel sat and taught, “Trees are destined to yield fruit every day, for it is said, ‘… and it shall bring forth branches, and bear fruit (Yechezkel 17:23).’ Just as the branches [exist] every day, so too new fruit will ripen every day.†A particular disciple mocked him quoting, “there is no new thing under the sun.†Rabban Gamaliel replied “Come, and I will show you its simile in this worldâ€. He went out and showed him the caper bush. On another occasion Rabban Gamaliel sat and taught, “[The soil of] Eretz Yisrael is destined to bring forth pastries and silk robes, for it is said, ‘there shall be grain as large as a handbreadth in the land (Tehillim72:16).’† A particular disciple mocked him quoting, “there is no new thing under the sun.†Rabban Gamaliel replied “Come, and I will show you its simile in this worldâ€. He went out and showed him morels and truffles; and for silk robes [he showed him] the bark of a young palm-shoot.
— Shabbos 30B
 Rav Yehudah said in Rav’s name: Of all that the Holy One, blessed be He, created in His world, He did not create a single thing lacking a purpose.
— Shabbos 77B
The kingdom of the earth is analogous to the Kingdom of Heaven.
— Zohar Miketz 197A
Rav Shmuel bar Nachmani said in the name of Rav Yonasan: in his dreams a man is not shown anything other than the musings of his own heart.
— Brachos 55B
The musings of his own heart. i.e. what he ponders during the day/ waking hours [is what he dreams about while sleeping]
— Rashi ibid
On a superficial level the fall from grace of Pharaohs wine steward and the baker and the wine steward’s rehabilitation reads like just another instance of palace politics that have characterized the courts of kings from time immemorial. However Rav Leibeleh Eiger avers that, as the primary “audience†watching this drama unfold was Yoseph haTzaddik-the righteous; there is a profound lesson to be learned from it. As Rav taught everything has a purpose even if the purpose is not readily apparent or easily understood.
The episode of Rabban Gamiel and his skeptical student teaches us that some of G-ds creations serve a dual purpose; their utilitarian function in the temporal here-and-now world, as well as serving as symbols and allegories for matters spiritual or belonging to the eternal world-to-come. The sanctified-poetic sensibility and the discerning eye perceive some of the loftiest, transcendent matters in the most mundane of allegories.
Rav Leibeleh Eiger goes a step further and says that some creatures and historical events one and only purpose is to function as hints and allusions to the inner metaphysical realities that they allegorize. This is particularly true in the politics, intrigues, pomp and ceremony of royal courts as the operative principle is that “the kingdom of the earth is analogous to the Kingdom of Heaven.†This is even truer here with Yoseph haTzaddik as the Divinely intended audience. It is part of a tzaddiks job description to cultivate a penetrating and discerning awareness to tunnel in and mine lessons from the pnimiyus-inner content; of all that meets his eyes.
The primary qualitative difference between the respective dreams of the baker and the wine steward is that the bakers dealt with a final product , a processed food; fine white bread, while the wine stewards dealt with the most primary source of the beverage; the grapevine itself. Both men found themselves incarcerated and in a dire predicament for having been deficient in their service to Pharaoh. The wine steward desired to do teshuvah-repentance; and tikun– repair; to restore his former relationship with his master and invested a lot of time reflecting on what went wrong and how he could set things right.