א"ר אבא אמר שמואל שלש שנים נחלקו ב"ש וב"ה הללו אומרים הלכה כמותנו והללו אומרים הלכה כמותנו יצאה בת קול ואמרה אלו ואלו דברי אלהים חיים הן והלכה כב"ה וכי מאחר שאלו ואלו דברי אלהים חיים מפני מה זכו ב"ה לקבוע הלכה כמותן מפני שנוחין ועלובין היו ושונין דבריהן ודברי ב"ש ולא עוד אלא שמקדימין דברי ב"ש לדבריהן
Rabbi Abba said in the name of Shmuel, For three years, the House of Hillel and the House of Shammai argued. One said, 'The halakha is like us,' and the other said, 'The halakha is like us.' A heavenly voice spoke: "These and these are the words of the living God, and the halakha is like the House of Hillel." A question was raised: Since the heavenly voice declared: "Both these and those are the words of the Living God," why was the halacha established to follow the opinion of Hillel? It is because the students of Hillel were kind and gracious. They taught their own ideas as well as the ideas from the students of Shammai. Not only for this reason, but they went so far as to teach Shammai's opinions first.
אלו ואלו דברי אלקים חיים שאלו רבני צרפת ז״ל היאך אפשר שיהו אלו ואלו דברי אלקים חים וזה איסר וזה מתיר ותרצו כי כשעלה משה למרום לקבל התורה הראו לן על כל דבר ודבר מ״ט פנים לאיסור ומ״ט פני׳ להיתר ושאל להקב״ה על זה ואמר שיהא זה מסור לחכמי ישראל שבכל דור ודור ויהיה הכרעה כמותם ונכון הוא לפי הדרש ובדרך האמת יש טעם סוד בדבר.
Ritva (Rabbi Yom Tov ben Avraham Asevilli (Commentary on Eruvin 13b [How can it be that] Elu v’elu divrei Elohim chaim -- These and These are the words of the Living G-d? The Rabbis of France [i.e. the Tosafists] may their memories be blessed, asked: How can it be that both of them spoke the words of the Living G-d, yet one side said [for example, an object is] forbidden and one said it is permissible? They resolved it by noting that when Moshe went up to the heights to receive the Torah, it was shown to him 49 reasons why something is permissible, and 49 reasons why it is forbidden. He asked the Holy One Blessed Be He about this, and was told that this is left to the sages of Israel in every generation, and the ruling will be as they decide