What is meant by "[X] shall inherit the earth"? This phrase is found countless times in the scripture (cf. Psalm 37:11, Matthew 5:5), but should this be interpreted as a physical possession of land? If the righteous all end up in Jerusalem, what use would people have of the earth?
Is Matthew 5.5 in the same line of thought?
To start, we should double check that Matthew 5.5 is relevant to interpreting any texts from the Hebrew scriptures ('Old Testament'). We want to be careful not to group it with those texts if they're not even using the same language. A simple way to verify this is to compare Matthew 5.5 with the Greek translation of the other verse provided in the original question.
In Matthew 5.5, the Greek phrase used is 'κληρονομησουσι την γην'. In Psalm 37.11, the Greek phrase used in the Septuagint (numbered as 36.11) is 'κληρονομησουσιν γην'. Same verb, same noun. In both cases, it is the 'πραεις' (meek, mild) who will inherit. This would immediately suggest the Jesus logia in question was following a common expression of Jewish thought, so we're justified in keeping it a part of the discussion.
Inherit the... what?
Something to take note of is that the Greek word for 'earth' (γην, gen) in Matthew 5.5 and LXX Psalm 36.11 can just as well be translated 'land' or even 'ground'. The same is true for the Hebrew word (ארץ, 'erets), used in Psalm 37.11. So to fully grasp which definition of 'earth' is being used, we should understand it as it is used in conjunction with 'inherit' (Greek κληρονομεω; Hebrew ירש).
In the Hebrew scriptures
Taking the Hebrew scriptures in their present shape, the 'earliest' place we find this specific combination of the verb 'inherit' (ירש) and the noun ארץ is in Genesis 15.7, where God promises an ארץ to Abram that he will 'inherit'. As the narrative of Genesis continues, it becomes clear this ארץ is the 'land' that Abram's descendants would settle to live in, and not the whole planet.
The phrase 'inheriting the land' is used for the land promised to Abram throughout the historical narrative of the Hebrew scriptures (Genesis 28.4; Leviticus 20.24; Numbers 21.24,35; 33.52-55; Joshua 1.11,15; 12.1). The pairing of this verb and noun is found more than 40 times (almost half of the total) in the book of Deuteronomy alone, almost all of which are used in this sense.
The pairing is used in a negative sense on occasion in the same books mentioned above, referring to the people who then-currently 'possessed' the 'land', tribes that Israel was instructed to expel from the area (e.g. Judges 1.27,32-33).
To 'inherit the land' is to possess and dwell in the specific geographical region that God promised to Abraham.
When we find the phrasing used in the Psalms (only eight times, five of which are in Psalm 37), it is historically probable that the above is the intended meaning: to dwell in the land of Israel. This is most obvious in Psalm 44.3 and 105.44, both of which are psalms about the entry of the Israelite tribes into the land of Canaan to 'inherit' it.
There are only two exceptions that I can find. One, Isaiah 14.21, seems to use it in a more global sense. A prophecy is made against the kingdom of Babylon, 'lest [the sons of the king of Babylon] rise and inherit the earth'. The other, Habakkuk 1.6, also uses it for Chaldea (Neo-Babylon), but because it is a prophecy of judgment against Judah, it may still yet be referring to the specific region of Israel, and not in a global sense.
In Matthew 5.5
The specific pairing of the verb 'inherit' (κληρονομεω) and noun 'land' (γην) is found only in Matthew 5.5 in the New Testament. Although it is a part of the Beatitudes (Matthew 5.1-12), it is not found in the Lukan parallel (Luke 6.20-23). Arguably, this is in keeping with Matthew being the more 'Jewish' of the two books, as is widely suggested.
When we take the Beatitudes in the larger context of Matthew's 'Sermon on the Mount', it kicks off a series of Jesus' logia specifically concerned with how one must act in order to truly be faithful to 'the Law and the Prophets'.
Within this context, we see that even when Jesus uses the phrase 'inherit the land', it should not be understand in an arbitrarily global sense, but within his historical context: an Israelite speaking to other Israelites, about who will inherit the land of Israel, and how they should act in order to do so.
While Matthew 5:5 echoes Psalm 37:11, it's not obvious that they have the same horizons, so I will take them one at a time and then offer a summary.
A canonical reading of Psalm 37:11 places the verse in the context of a number of Psalms about David (essentially 3-41). Psalm 37 itself is marked as "Of David" indicating that the primary referent should be David. Moreover, Psalm 37 contains strong overtones of Psalms 1 and 2. The author is waiting for the wicked to blow away like chaff (cf. 37:1-2, 1:4). The wicked meanwhile are plotting to overthrow the king, but God laughs at them (cf. 37:12-13, 2:1-4).
So when we read "The meek shall inherit the land/earth", we should have two contexts in mind:
First, the ascription on Psalm 37 means that we should have in mind the context of the Davidic covenant where the rule over Israel having peace in the land was promised to David and his son (see 2 Samuel 7:8-11). In this context, "land" in Psalm 37:11 refers to the land of Israel promised first to Abraham.
But second, because of the connection with Psalm 2 and the Davidide, we should also keep the programmatic context of Psalms 1 and 2 in mind. In doing so we should let the promise in 2:8 take its full effect, where the son of David is told "Ask of me and I will make the nations your inheritance, the ends of the earth your possession." In other words, in Psalm 37:11 the "land" should also be read in light of this promise of the ends of the earth as a possession.
Again, in Matthew 5:5, we should not let a single context control the meaning or we might needlessly narrow our interpretation.
The echo of Psalm 37:11 is certainly one context for Matthew 5:5. It propels us to think of the earth/land in terms of the land promised to Abraham. There are a number of other contexts that point in the same direction. John Nolland (NIGTC) notes, for example:
The interest in 4:25 in the scope of historic Israel ... and the evocation of exile and return in the opening beatitudes weigh in favour of Matthew’s also intending γῆ to refer to Israel as the land of covenant promise.1
But there is another context as well to consider. Jonathan Pennington argues2 for the theme of heaven and earth as a key interpretive element in the Gospel of Matthew. Consider the following sample of verses (ESV):
6:10-11 Do not lay up for yourselves treasures on earth... But lay up for yourselves treasures in heaven.
16:19 I will give you the keys of the kingdom of heaven, and whatever you bind on earth shall be bound in heaven, and whatever you loose on earth shall be loosed in heaven.”
23:9 And call no man your father on earth, for you have one Father, who is heaven.
Two particularly relevant instances are in the Lord's prayer and in the Great Commission:
6:10 Your kingdom come, your will be done, on earth as it is in heaven.
28:18 And Jesus can and said to them, "All authority in heaven and on earth has been given to me."
We see in the prayer the kingdom of heaven coming to earth. And we see in the commission that all authority in heaven and earth was given to one man. Matthew highlights for a time the differences between the kingdom of heaven and the kingdoms of the earth, but the eschatological end of his gospel is that the kingdom of heaven is come to earth.
With this context, a reading of Matthew 5:5 in parallel with 5:3 and 5:10 and the promise of the kingdom of heaven, the statement that the meek will inherit the earth expands beyond the land of Israel to the kingdom of heaven come to earth.
On one horizon, the inheritance of the land in Psalm 37:11 pertains to a physical possession of the land of Israel by the Davidic king (possibly even David himself). But on another horizon, it also looks forward to the Davidic son's rule over the nations.
The beatitude in Matthew, however, is not pertaining to a literal referent, but a spiritual one in keeping with Matthew's distinction between the kingdom of heaven and the kingdoms of the earth. This is the case whether we are reading γῆ as meaning the "land" or the "earth." It brings in tones from these two ideas, but it reinterprets them in a spiritual way.
Finally, assuming that your question about the relationship between Jerusalem and this earth stems from a reading of Revelation 21, I'd encourage a second look at that passage. The heavenly city - the new Jerusalem - is also called the bride of the Lamb. And it is coming down from heaven to earth. Or in Matthew's terms: it is the kingdom of heaven being brought to the earth.
1 Nolland, John. (2005). Preface. In The Gospel of Matthew: A Commentary on the Greek text (p. 202). Grand Rapids, MI; Carlisle: W.B. Eerdmans; Paternoster Press.
The scriptural hope has always been to live with God in the promised land in the middle east on the dry land above the abyss and below the sky ceiling:
Gen 13:15 because I'm going to give you and your descendants all of the land that you see—forever!
The promise was not going to be realized by all of the Jews but was conditioned on obedience:
Deu 8:1 "Be careful to observe every command that I'm instructing you today, in order that you may live, increase, and enter and take possession of the land that the LORD promised by an oath to your ancestors.
It was the condition of obedience of Deut 8 that the rich young ruler discussed with Jesus:
Luk 18:18 Then an official asked Jesus, "Good Teacher, what must I do to inherit eternal life?" Luk 18:19 "Why do you call me good?" Jesus asked him. "Nobody is good except for God. Luk 18:20 You know the commandments: 'Never commit adultery. Never murder. Never steal. Never give false testimony. Honor your father and mother.'"
So why did Jesus mention "treasure in the sky"? Well, God is "the highest one" ("most high") and made the sky his home/"dwelling place" in the sky:
1Ki 8:49 Then hear thou their prayer and their supplication in heaven thy dwelling place, and maintain their cause,
So when people are obedient they "lay up treasures in the sky". God is like a bank. The Jews speak of a "treasury of merit". But here Jesus says that to put one's treasure in the sky-bank one must give up all one's earthly treasures:
Luk 18:21 The official replied, "I have kept all of these since I was a young man." Luk 18:22 When Jesus heard this, he told him, "You still need to do one thing. Sell everything you have and give the money to the destitute, and you will have treasure in heaven. Then come back and follow me."
What you give to the poor is repaid by God:
Deu 32:34 "Is this not kept in reserve, sealed up with me in my treasury? Deu 32:35 To me belong vengeance and recompense. In due time their feet will slip, because their time of calamity is near and the things prepared for them draw near. Deu 32:36 For the LORD will vindicate his people and bring comfort to his servants, because he will observe that their power has waned, when neither prisoner nor free person remain.
Mat 25:34 "Then the king will say to those on his right, 'Come, you who have been blessed by my Father! Inherit the kingdom prepared for you from the foundation of the world, Mat 25:35 because I was hungry, and you gave me something to eat. I was thirsty, and you gave me something to drink. I was a stranger, and you welcomed me. Mat 25:36 I was naked, and you clothed me. I was sick, and you took care of me. I was in prison, and you visited me.' Mat 25:37 "Then the righteous will say to him, 'Lord, when did we see you hungry and give you something to eat, or thirsty and give you something to drink? Mat 25:38 When did we see you as a stranger and welcome you, or see you naked and clothe you? Mat 25:39 When did we see you sick or in prison and visit you?' Mat 25:40 The king will answer them, 'I tell you with certainty, since you did it for one of the least important of these brothers of mine, you did it for me.'
So while God currently operates (probably through "the servant", Jesus) the bank in his dwelling place in the sky. But like all of us do, he's going to move:
Rev 21:2 I also saw the holy city, New Jerusalem, coming down from God out of heaven, prepared like a bride adorned for her husband. Rev 21:3 I heard a loud voice from the throne say, "See, the tent of God is among humans! He will make his home with them, and they will be his people. God himself will be with them, and he will be their God.
So, the scriptural hope is not, never was and never will be to "go to heaven". Matthew 5:5 is referring to the promised land.