But because he later recognized, as he says in the same psalm: I strove to understand, and he added: This was an oppressive task to me, why the wicked are happy, this was an oppressive task to me, he says, until I entered the sanctuary of God and understood their final destiny, because to the wicked, happiness is given for a time, but eternal punishment is reserved at the end. When he understood this, he became upright in heart and began to praise God in all things, and in the sufferings of the pious, and in the very happiness of the impious, perceiving that God is a just rewarder at the end, ...now giving some temporal happiness to whom He reserves eternal unhappiness at the end, and some pious ones undergoing present unhappiness to whom He again reserves eternal happiness; and it is fitting for the fortunes to change, as in the case of that rich man who feasted splendidly every day, and that poor man full of sores lying at the rich man's gate, desiring to be fed with what fell from the rich man's table. But when both had died, the rich man began to be in torment in hell, while the poor man rested in Abraham's bosom. And when it seemed unworthy to the rich man, and he wanted a drop of water from Lazarus' finger to be dropped on him, reciprocally desiring a drop from the finger of him from whose table he had desired a crumb, he heard from Abraham the sentence of the just God: Son, remember that you received good things in your lifetime, and Lazarus bad things; but now he is comforted here and you are in anguish. He, who once did not think God was good because he envied the peace of the sinners, upon entering the sanctuary of God directed his gaze to these final things. And recognizing God's true and just judgment, which indeed operates now but secretly, to be revealed in the end in manifestation, and as if straightening his own crooked heart, brought near as it were by the rule of God's justice by which a tortuous heart would be corrected, he burst forth in this voice and said: How good is God to Israel, to those who are upright in heart! Now I understand the good, because I have become upright in heart. But before, He did not seem good to me, because my feet slipped: For I was envious of the arrogant when I saw the prosperity of the wicked.
Source: SERMON 15A:2