(א) ומלכי צדק מלך שלם, הוא ירושלים, וכן כתוב ויהי בשלם סכו (תהלים ע"ו) ונקראו מלכי ירושלים מלכי צדק מן אדני צדק וכן כתוב בספר יהושע אדני צדק מלך ירושלים (י' א'), כי ירושלים הוא מקום הצדק והשלום לא יסבול עול וחמס ומעשה תועבה זמן ארוך, לפיכך מקיא החטאים היושבים בה. כמו שאמר ולא תקיא הארץ אתכם בטמאכם אותה כאשר קאה את הגוי אשר לפניכם (ויקרא י"ח) ואמר אלהי נכר הארץ (דברים ל"א) כי היא כנגד קו השוה ואוירה מזוג, וכן אמר יפה נוף משוש כל הארץ (תהלים מ"ט) ואמרו בדרש (פדר"א כ"ז, ב"ר נ"ו נדרים ל"ב) כי מלכי צדק הוא שם בן נח.
(1) ומלכי צדק מלך שלם, the word שלם is another word for ירושלים, and we find it referred to as such in Psalms 76,3 ויהי בשלם סכו, “Salem became His abode.” It was customary to give the title Malki Tzedek or Adoni Tzedek, to kings of Jerusalem in those days, just as the kings of Egypt were called Pharaoh. Compare Joshua 10,1 where we find אדני צדק מלך ירושלים. Jerusalem traditionally represented the center of righteousness and peace. It is a place in which iniquity is less tolerated than anywhere else. This is why the Torah warned in Leviticus 18,28 that the Israelites should take care that the land not spew them out just as it had spewed out previous inhabitants because they had defiled it. The reason the Torah in Deuteronomy 31,16 uses the somewhat enigmatic expression אלוהי נכר הארץ, is that the kind of conduct by the people in that city that were spewed out, was a conduct that was irreconcilable (alien) with the very nature, spiritual climate, prevailing in, and being part of that holy city. The sons of Korach already recognised and extolled this spiritual climate of the very city when they said in Psalms 48,3 יפה נוף משוש כל הארץ הר ציון ירכתי צפון קרית מלך רב, “fair-crested, joy of all the earth, Mount Zion, summit of Tzafon, city of the great King.” In the Midrash quoted by Rashi, Malki Tzedek is identified as Shem, the son of Noach.
(א) וַיְהִי֩ כִשְׁמֹ֨עַ אֲדֹֽנִי־צֶ֜דֶק מֶ֣לֶךְ יְרוּשָׁלִַ֗ם כִּֽי־לָכַ֨ד יְהוֹשֻׁ֣עַ אֶת־הָעַי֮ וַיַּחֲרִימָהּ֒ כַּאֲשֶׁ֨ר עָשָׂ֤ה לִֽירִיחוֹ֙ וּלְמַלְכָּ֔הּ כֵּן־עָשָׂ֥ה לָעַ֖י וּלְמַלְכָּ֑הּ וְכִ֨י הִשְׁלִ֜ימוּ יֹשְׁבֵ֤י גִבְעוֹן֙ אֶת־יִשְׂרָאֵ֔ל וַיִּֽהְי֖וּ בְּקִרְבָּֽם׃
(ג) וַיְהִ֣י בְשָׁלֵ֣ם סֻכּ֑וֹ וּמְע֖וֹנָת֣וֹ בְצִיּֽוֹן׃
(ו) מלכי צדק מלך שלם וגו' - ומלכי צדק מלך שלם, המקום הזה מצדיק את יושביו. מלכי צדק, אדוני צדק, צדק נקראת ירושלים, שנאמר (ישעיה א) צדק ילין בה מלך שלם.
(יד) הִנֵּ֛ה יָמִ֥ים בָּאִ֖ים נְאֻם־יְהוָ֑ה וַהֲקִֽמֹתִי֙ אֶת־הַדָּבָ֣ר הַטּ֔וֹב אֲשֶׁ֥ר דִּבַּ֛רְתִּי אֶל־בֵּ֥ית יִשְׂרָאֵ֖ל וְעַל־בֵּ֥ית יְהוּדָֽה׃ (טו) בַּיָּמִ֤ים הָהֵם֙ וּבָעֵ֣ת הַהִ֔יא אַצְמִ֥יחַ לְדָוִ֖ד צֶ֣מַח צְדָקָ֑ה וְעָשָׂ֛ה מִשְׁפָּ֥ט וּצְדָקָ֖ה בָּאָֽרֶץ׃ (טז) בַּיָּמִ֤ים הָהֵם֙ תִּוָּשַׁ֣ע יְהוּדָ֔ה וִירוּשָׁלִַ֖ם תִּשְׁכּ֣וֹן לָבֶ֑טַח וְזֶ֥ה אֲשֶׁר־יִקְרָא־לָ֖הּ יְהוָ֥ה ׀ צִדְקֵֽנוּ׃ (ס)
Or Hachayim Bereitshit 14:18
The reason for the Torah creating a break with the matter of the King of Shalem, in between the King of Sodom going out and the reporting of Avraham's words, is to speak the praise of the righteous and [to emphasize] the contrast between them and the wicked. For the King of Sodom went out empty-handed to greet Avraham, even though he should rightfully have received him with a royal welcome, but that wicked one went out empty-handed, while the righteous Shem owing him no favors greeted him with bread and wine.