The "just world fallacy"or illusion is a cognitive bias that assumes the consequences of actions are morally determined -- that people ultimately get what they deserve based on the rightness of their actions. Psalms 36 and 37 are among many that express this fallacy as fact. Indeed, the just world fallacy is central to most religions -- God rewards the righteous and faithful, and punishes the wicked and impious. Of course this is not true.
Note verse 11 of Psalm 37, which the RSV translates as "The meek shall possess the land." KJV translates this as "The meek shall inherit the earth," and I suspect that the Hebrew is the same as Matthew 5, which is also usually translated as "The meek shall inherit the earth." As we have seen, a lot of material in the gospels is lifted from the psalms.
To the choirmaster. A Psalm of David, the servant of the Lord.
36 Transgression speaks to the wicked
deep in his heart;
there is no fear of God
before his eyes.
2 For he flatters himself in his own eyes
that his iniquity cannot be found out and hated.
3 The words of his mouth are mischief and deceit;
he has ceased to act wisely and do good.
4 He plots mischief while on his bed;
he sets himself in a way that is not good;
he spurns not evil.
5 Thy steadfast love, O Lord, extends to the heavens,
thy faithfulness to the clouds.
6 Thy righteousness is like the mountains of God,
thy judgments are like the great deep;
man and beast thou savest, O Lord.
7 How precious is thy steadfast love, O God!
The children of men take refuge in the shadow of thy wings.
8 They feast on the abundance of thy house,
and thou givest them drink from the river of thy delights.
9 For with thee is the fountain of life;
in thy light do we see light.
10 O continue thy steadfast love to those who know thee,
and thy salvation to the upright of heart!
11 Let not the foot of arrogance come upon me,
nor the hand of the wicked drive me away.
12 There the evildoers lie prostrate,
they are thrust down, unable to rise.
A Psalm of David.
37 Fret not yourself because of the wicked,
be not envious of wrongdoers!
2 For they will soon fade like the grass,
and wither like the green herb.
3 Trust in the Lord, and do good;
so you will dwell in the land, and enjoy security.
4 Take delight in the Lord,
and he will give you the desires of your heart.
5 Commit your way to the Lord;
trust in him, and he will act.
6 He will bring forth your vindication as the light,
and your right as the noonday.
7 Be still before the Lord, and wait patiently for him;
fret not yourself over him who prospers in his way,
over the man who carries out evil devices!
8 Refrain from anger, and forsake wrath!
Fret not yourself; it tends only to evil.
9 For the wicked shall be cut off;
but those who wait for the Lord shall possess the land.
10 Yet a little while, and the wicked will be no more;
though you look well at his place, he will not be there.
11 But the meek shall possess the land,
and delight themselves in abundant prosperity.
12 The wicked plots against the righteous,
and gnashes his teeth at him;
13 but the Lord laughs at the wicked,
for he sees that his day is coming.
14 The wicked draw the sword and bend their bows,
to bring down the poor and needy,
to slay those who walk uprightly;
15 their sword shall enter their own heart,
and their bows shall be broken.
16 Better is a little that the righteous has
than the abundance of many wicked.
17 For the arms of the wicked shall be broken;
but the Lord upholds the righteous.
18 The Lord knows the days of the blameless,
and their heritage will abide for ever;
19 they are not put to shame in evil times,
in the days of famine they have abundance.
20 But the wicked perish;
the enemies of the Lord are like the glory of the pastures,
they vanish—like smoke they vanish away.
21 The wicked borrows, and cannot pay back,
but the righteous is generous and gives;
22 for those blessed by the Lord shall possess the land,
but those cursed by him shall be cut off.
23 The steps of a man are from the Lord,
and he establishes him in whose way he delights;
24 though he fall, he shall not be cast headlong,
for the Lord is the stay of his hand.
25 I have been young, and now am old;
yet I have not seen the righteous forsaken
or his children begging bread.
26 He is ever giving liberally and lending,
and his children become a blessing.
27 Depart from evil, and do good;
so shall you abide for ever.
28 For the Lord loves justice;
he will not forsake his saints.
The righteous shall be preserved for ever,
but the children of the wicked shall be cut off.
29 The righteous shall possess the land,
and dwell upon it for ever.
30 The mouth of the righteous utters wisdom,
and his tongue speaks justice.
31 The law of his God is in his heart;
his steps do not slip.
32 The wicked watches the righteous,
and seeks to slay him.
33 The Lord will not abandon him to his power,
or let him be condemned when he is brought to trial.
34 Wait for the Lord, and keep to his way,
and he will exalt you to possess the land;
you will look on the destruction of the wicked.
37 Mark the blameless man, and behold the upright,
for there is posterity for the man of peace.
38 But transgressors shall be altogether destroyed;
the posterity of the wicked shall be cut off.
39 The salvation of the righteous is from the Lord;
he is their refuge in the time of trouble.
40 The Lord helps them and delivers them;
he delivers them from the wicked, and saves them,
because they take refuge in him.