Quick answer
Punishing someone for doing right is named, plainly, as not good. The verse closes the chapter's run on corrupted justice.
Read both lines
"Not good" is understatement, and the flatness is characteristic of legal formulations in this book. What both halves share is the reason for the punishment: it is not despite their uprightness but for it, which describes retaliation against integrity rather than an error in sentencing. Set beside verse 15, the chapter has now covered both failures of the courtroom from two angles, the verdict sold and the honest man struck, and it treats them as the same disorder.
Related: Proverbs 17:15 · Proverbs 18:5 · Proverbs 24:23–25
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.