Not much of a penalty if you get the money back. Have it donate to an organisation or political party you cannot stand instead - you'll have a stronger incentive to minimise the damage if every dollar goes to the enemy.
However, if done right, it's feasible that users could end up having $50 or thereabouts perpetually in the swear jar...which (at least for me) would be a big disincentive.
If the penalty is immediate, obvious and doesn't explicitly remind you that you will get your money back, then I contend the brain's instinct is to cringe.
Maybe you get the money back in 3 months rather than 1 month: you see a browser plugin displaying how much you've already spent on HN and you think "ouch...I'm not getting that back for a while".
For people who weren't necessarily good at saving money, it might prove to be an effective savings technique ("Oh $50, just in time to pay the water bill!') rather than a disincentive. You need to lose the money, even if it's just to your wife to spend on shoes.
Have heard of it before so I suspect it's already been done at some level though I think it related to longer-term goals (e.g., quit smoking by date x or lose your 'bond' to some nutbag political org).