"And you shall do My statutes etc. [But the land shall not be sold in perpetuity]" (Leviticus 25:18, 23). The Holy One, blessed be He, said to him: Just as I sold My people and yet returned again and drew them near, as it is said, "Return, O backsliding children, [says] the LORD, for I am a master over you" (Jeremiah 3:14); and it is written, "[For] thus says the LORD: You were sold for nothing, and you shall be redeemed without money" (Isaiah 52:3) — therefore the land shall not be sold absolutely, as it is said, "And the land shall not be sold in perpetuity, for the land is Mine" (Leviticus 25:23). The Land of Israel is dear to Me, for I sanctified it above all the lands. Know it for yourself: when the Land of Israel was being divided among the tribes, it did not pass from tribe to tribe, but each tribe was apportioned by itself. Know it for yourself and see how many judgments the daughters of Zelophehad pleaded, that their inheritance should not pass over from one tribe to another tribe; and the Holy One conceded to their words, as it is said, "The daughters of Zelophehad speak rightly etc." (Numbers 27:7), and "no inheritance shall move from one tribe to another tribe" (Numbers 36:9). Therefore, if a fitting redeemer is found for him — good; and if not, the one who bought it works it before him until the Jubilee, and releases it at the Jubilee, as it is said, "then he shall go out [from you], he and his children with him" (Leviticus 25:41). The Holy One said: When the year of redemption draws near, I will redeem you, as it is said, "for the day of vengeance is in My heart, and My year of redemption has come" (Isaiah 63:4).
Why the Land of Israel Cannot Be Sold Forever
Midrash Tanchuma Buber, Behar 4:1
ועשיתם את חקותי וגו' [והארץ לא תמכר לצמיתות] (שם כה יחי ג). א"ל הקב"ה כשם שמכרתי את עמי, וחזרתי עוד וקרבתים, שנאמר שובו בנים שובבים (אמר) [נאום] ה' כי (אני( [אנכי] בעלתי בכם (ירמיה ד יד), וכתיב [כי] כה אמר ה' חנם נמכרתם ולא בכסף תגאלו (ישעיה נב ג), לכך לא תמכר הארץ לחלוטין, שנאמר והארץ לא תמכר לצמיתות כי לי הארץ (ויקרא כה כג), חביבה עלי ארץ ישראל שקידשתי אותה מכל הארצות, תדע לך כשהיתה ארץ ישראל מתחלקת לשבטים, לא היתה עוברת משבט לשבט, אלא [נחלקת] כל שבט בפני עצמו, תדע לך וראה כמה דינין דנו בנות צלפחד שלא תתעבר נחלתן משבט לשבט אחר, והודה הקב"ה לדבריהם, שנאמר כן בנות צלפחד דוברות וגו' (במדבר כז ז), ולא תסוב נחלה ממטה למטה אחר (שם לו ט), לפיכך אם נמצא לו גואל יפה, ואם לאו מי שלקחה עשה לפניו עד היובל ומוציאה ביובל, שנאמר ויוצא (ביובל) [מעמך] הוא ובניו עמו (ויקרא כה מא), אמר הקב"ה כשתקרב שנת הגאולה אני גואל אתכם, שנאמר כי יום נקם בלבי ושנת גאולי באה (ישעיה סג יד).