"Of old hast thou laid the foundation of the earth, and the heavens are the work of thy hands" (Psalms 102:25). The House of Shammai and the House of Hillel. The House of Hillel say: The earth was created first, and afterward the heavens were created. And the House of Shammai say: The heavens were created first, and afterward the earth was created. These bring a reason for their words, [and these bring a reason for their words]. According to the opinion of the House of Hillel, who say the earth was created first and afterward the heavens were created: [a parable] of a king who built himself a palace. When he had built the lower parts, [afterward] he built the upper parts; "in the day that the LORD God made earth and heaven" (Genesis 2:4). According to the opinion of the House of Shammai, who say the heavens were created first and afterward the earth was created: [a parable] of a king who made himself a throne; once he had made it, he made his footstool. [Thus said the Holy One, blessed be He:] "The heaven is my throne, and the earth is my footstool" (Isaiah 66:1). Rabbi Yose bar Rabbi Chanina said: Scripture supports the House of Shammai. Rabbi Chanina said: Wherever Scripture supports the words of the House of Shammai, from there the House of Hillel remove them. "In the beginning God created" etc. "and the earth was" (Genesis 1:1-2) — the earth already was. Rabbi Yochanan in the name of the Sages: For creation, the heavens came first; for the completion, the earth came first. Rabbi Tanchuma said: I will state the reason. For creation, the heavens came first — "In the beginning God created" etc. For the completion, the earth came first — "in the day that the LORD God made earth and heaven." Rabbi Shimon ben Yochai said: I am astonished how the fathers of the world, the House of Shammai and the House of Hillel, disputed over the creation of heaven and earth. [Rather I say] that the heavens and the earth were created only like a pot and its lid, as it is said, "Mine hand also hath laid the foundation of the earth, and my right hand hath spanned the heavens: when I call unto them, they stand up together" (Isaiah 48:13). Rabbi Elazar son of Rabbi Shimon said: If it is as my father said, sometimes it puts the heavens before the earth, and sometimes it puts the earth before the heavens. In every place it puts the heavens before the earth, but in one place it says "in the day that the LORD God made earth and heaven" (Genesis 2:4) — this tells that the two of them are equal to one another. In every place it puts Moses before Aaron, but in one place it says "that is Aaron and Moses" (Exodus 6:26) — this tells that the two of them are equal to one another. In every place it puts Abraham before Isaac and Isaac before Jacob, but in one place it says "then will I remember my covenant with Jacob" etc. (Leviticus 26:42) — this tells that the three of them are equal to one another. "They shall perish, but thou shalt endure; yea, all of them shall wax old like a garment" (Psalms 102:26). Rabbi Abba bar Kahana said: They wear out, but You do not wear out. "There is none holy as the LORD, for there is none beside thee (ki ein biltekha)" (1 Samuel 2:2) — [read it] "there is no wearing-out of You (ki ein biloteikha)."
House of Hillel and Shammai on Whether Heaven or Earth Came First
Midrash Shmuel 5:1
לפנים הארץ יסדת ומעשה ידך שמים (תהלים ק"ב כ"ו). בית שמאי ובית הלל, בית הלל אומרים הארץ נבראת תחלה ואחר כך נבראו שמים, ובית שמאי אומרים שמים נבראו תחלה ואחר כך נבראת הארץ, אלו מביאין טעם לדבריהם, [ואלו מביאין טעם לדבריהם], על דעתהון דבית הלל דאינון אמרין הארץ נבראת תחלה ואחר כך נבראו שמים, [משל] למלך שבנה לו פלטין, משבנה את התחתונים [אח"כ] בנה את העליונים, ביום עשות ה' אלהים ארץ ושמים (בראשית ב' ד'). על דעתהון דבית שמאי דאינון אמרין שמים נבראו תחלה ואח"כ נבראת הארץ, [משל] למלך שעשה לו כסא משעשאו עשה אפופוריא שלו, [כך אמר הקדוש ברוך הוא] השמים כסאי והארץ הדום רגלי (ישעי' ס"ו א'), אמר רבי יוסי בר רבי חנינה קרייה מסייע לבית שמאי, אמר רבי חנינה כל מקום שהמקרא מסייע לדברי בית שמאי משם דבית הלל מסלקין אותם, בראשית ברא אלהים וגו' והארץ היתה, הארץ כבר היתה, רבי יוחנן בשם חכמים לברייה שמים קדמו, לשכלול הארץ קדמה, אמר רבי תנחומא אנא אימא טעמא, לברייה שמים קדמו, בראשית ברא אלהים וגו', לשכלול הארץ קדמה, ביום עשות ה' אלהים ארץ ושמים, אמר רבי שמעון בן יוחי תמיה אנא היאך נחלקו אבות העולם בית שמאי ובית הלל על בריאת שמים וארץ, [אלא אני אומר] שהשמים והארץ לא נבראו אלא כלפס וככסויה, שנאמר אף ידי יסדה ארץ וימיני טפחה שמים קורא אני אליהם יעמדו יחדו (ישעי' מ"ח י"ג), אמר רבי אלעזר ברבי שמעון אם כדעת שאמר אבא פעמים שהוא מקדים שמים לארץ, ופעמים שהוא מקדים ארץ לשמים, בכל מקום הוא מקדים שמים לארץ, ובמקום אחד הוא אומר ביום עשות ה' אלהים ארץ ושמים (בראשית ב' ד'), מגיד ששניהן שקולין זה כזה, בכל מקום הוא מקדים משה לאהרן, ובמקום אחד הוא אומר הוא אהרן ומשה (שמות ו' כ"ו), מגיד ששניהן שקולין זה כזה, בכל מקום הוא מקדים אברהם ליצחק ויצחק ליעקב, ובמקום אחד הוא אומר וזכרתי את בריתי יעקב וגו' (ויקרא כ"ו מ"ב), מגיד ששלשתן שקולין זה כזה. המה יאבדו ואתה תעמוד וכלם כבגד יבלו (תהלים ק"ב כ"ז), אמר רבי אבא בר כהנא הינון בלין ואת לא בלי, אין קדוש כה' כי אין בלתך (שמואל א' ב' ב'), כי אין בלותיך.