Another interpretation of "Hearken, O My people, and I will speak" (Psalms 50:7). Rabbi Pinhas the Priest bar Hama said: "Hearken, O My people" — that I may have an opening of the mouth to answer the nations of the world. "O Israel, and I will testify against you" (Psalms 50:7). Rabbi Yose says: "I am God" — I am Judge, I am your Patron. (Rabbi Eleazar says: "I am God.") Rabbi Judah the Levite son of Rabbi Shallum says: It speaks of judges. He said to them: Because I called you gods, as it is said, "You shall not curse God" (Exodus 22:27), nevertheless know that I am above you: "God, your God, am I" (Psalms 50:7). Rabbi Pinhas the Priest bar Hama said: "Hearken, O My people" — that I may have an opening of the mouth to answer the nations of the world. "O Israel, and I will testify against you." Rabbi Yose says: "I am God" — I am Judge, I am your Patron. (Rabbi Eleazar says: "I am God.") Rabbi Judah the Levite son of Rabbi Shallum says: It speaks of judges. He said to them: Because I called you gods, as it is said, "You shall not curse God" (Exodus 22:27), nevertheless know that I am above you: "God, your God, am I" (Psalms 50:7). Rabbi Pinhas the Priest bar Hama said: The Holy One, blessed be He, said to Moses: Because I called you a god, as it is said, "See, I have made you a god to Pharaoh" (Exodus 7:1) — "God, your God, am I." And therefore it is said, "And God spoke to Moses, and said to him: I am the LORD" (Exodus 6:2).
Why God Called Israel and Moses Gods in Vaera
Midrash Tanchuma Buber, Vaera 1:2
ד"א שמעה עמי ואדברה. אמר ר' פנחס הכהן בר חמא שמעה עמי שיהא לי פתחון פה להשיב לאומות העולם, ישראל ואעידה בך, ר' יוסי אומר אלהים אני, דיין אני, פטרונך אני, (ר' אלעזר אומר אלהים אני), ר' יהודה הלוי בר' שלום אומר בשפטים הוא מדבר אמר להם, בשביל שקראתי אתכם אלהים, שנאמר אלהים לא תקלל (שמות כב כז), אלא היו יודעים שאני על גביכם אלהים אלהיך אנכי (תהלים שם), א"ר פנחס הכהן בר חמא שמעה עמי שיהא לי פתחון פה להשיב לאומות העולם, ישראל ואעידה בך, ר' יוסי אומר אלהים אני, דיין אני, פטרונך אני, (ר' אלעזר אומר אלהים אני), ר' יהודה הלוי בר' שלום אומר בשפטים הוא מדבר, אמר להם, בשביל שקראתי אתכם אלהים, שנאמר אלהים לא תקלל (שמות כב כז), אלא היו יודעים שאני על גביכם אלהים אלהיך אנכי (תהלים שם), א"ר פנחס הכהן בר חמא אמר הקב"ה למשה בשביל שקראתי אותך אלים, שנאמר ראה נתתיך אלהים לפרעה (שמות ז א), אלהים אלהיך אנכי, ולכך נאמר וידבר אלהים אל משה ויאמר אליו אני ה'.