⚑ The chapter's hardest verse. The noun is* kopher, *the ransom word, and this is not a verse about the atonement.
Quick answer
The trap set for the righteous closes on the one who set it. The verse observes a reversal in how things land, using a word that carries more freight in English than it does here.
Read both lines
Start with what the verse is describing, because the vocabulary will otherwise drive the reading. The plainest sense is a substitution of position: the harm aimed at one person arrives at the other instead. The book states exactly that at 11:8 without any loaded noun at all, saying the righteous is delivered from trouble and it comes to the wicked instead, and the two verses belong together. The second line of this one confirms the shape, since "the unfaithful for the upright" simply restates the exchange with different terms.
Why translations differ
Kopher is a real ransom word, used of a price that secures a release, and its presence here is what generates the difficulty. But its range is wider than atonement. Isaiah has God say "I gave Egypt for your ransom, Ethiopia and Seba in your place" (43:3), where the word describes nations exchanged in the course of history rather than sin covered before God. That is the register this proverb is working in. This expression is debated, and translations mostly leave "ransom" standing and let the context carry it.
What it does not mean
This verse is not a doctrine of substitutionary atonement, and it must not be used as one. Nothing here says a wicked person can pay for a righteous person's sin, which no proverb teaches and which would run against the whole shape of Scripture's answer to that problem. The New Testament names one ransom and one payer: the Son of Man came "to give His life a ransom for many" (Mark 10:45), and Paul says the Man Christ Jesus "gave Himself a ransom for all" (1 Timothy 2:6). The direction is the opposite of this proverb's. In Proverbs the wicked ends up where the righteous would have been; at the cross the righteous One went where the guilty were, willingly, and nobody was traded into His place.
It is also not a promise that harm will always land on the person who deserves it. This book knows better and says so, at 13:23 about the poor and throughout Job's whole argument. It is describing a pattern the world often shows, not a rule the world always keeps.
Related: Proverbs 11:8 · Isaiah 43:3 · Mark 10:45 · 1 Timothy 2:6 · Proverbs 13:23
New King James Version®, Copyright © 1982, Thomas Nelson. All rights reserved. Full copyright information. Scripture provided by API.Bible.
Go Deeper
If this verse has been used to put weight on you that it was never carrying, ask about it directly.