Let our master teach us further: What is the difference between the dreams of the righteous and the dreams of the wicked? The dreams of the wicked are neither in heaven nor on earth, as it is said, "And Pharaoh dreamed, and behold, he was standing over the Nile" (Genesis 41:1). And so too of Nebuchadnezzar it is written, "I saw a dream, and it made me afraid" (Daniel 4:2) — for it was neither on earth nor in heaven. But the dreams of the righteous are in heaven and on earth. For thus you find that Joseph said to his brothers, "Behold, we were binding sheaves" (Genesis 37:7) — this is on earth. And from where do we learn that they were also in heaven? As it is said, "Behold, the sun and the moon and eleven stars were bowing down to me" (Genesis 37:9). And so too with our father Jacob: "And he dreamed, and behold, a ladder was set on the earth, and its top reached to heaven" (Genesis 28:12) — this is in heaven and on earth.
Why Dreams of the Righteous Touch Both Heaven and Earth
Midrash Tanchuma Buber, Vayetzei 6:2
ילמדנו עוד רבינו מה בין חלומות הצדיקים לחלומות הרשעים, חלומות הרשעים לא בשמים ולא בארץ, שנאמר ופרעה חולם והנה עומד על היאור (בראשית מא א). וכך נבוכדנצר כתיב חלם (הוא) [חזית] ודחלנני (דניאל ד ב), שלא היה לא בארץ ולא בשמים, אבל חלומות של צדיקים בשמים ובארץ, שכן אתה מוצא שאמר יוסף לאחיו הנה אנחנו מאלמים אלומים (בראשית לז ז), הרי בארץ, ובשמים מנין, שנאמר הנה השמש והירח ואחד עשר כוכבים משתחוים לי (שם שם ט), וכן באבינו יעקב ויחלום והנה סולם [מוצב ארצה וראשו מגיע השמימה, הרי בשמים ובארץ].