(Pro 21:18 KJV) The wicked shall be a ransom for the righteous, and the transgressor for the upright.
To move toward understanding in this verse we need to start with the word “wicked” (7563). We need to get over our limited scope of wickedness. We tend to think of rapists and child molesters as wicked and they are. But the contrast here is with “righteous” (6662) not nice. A wicked person does not need to be a Nazi concentration camp guard in order to get the label. It could be your child’s kindergarten teacher or the lady next door who bakes you cookies.
When I have seen people suffer I have wondered why. What did they do to deserve the suffering? Usually it is nothing we can see but I think this is a promise that there will be more suffering for the wicked than the righteous. It could also be that God has some purpose that we will not understand this side of glory. We cannot judge.
So? Righteousness pays off today and in eternity. Believe it.