OK, not actually pain.
As a very interesting article in The New Yorker notes, people have been voluntarily putting themselves in knots since before Jason tied himself to the mast to avoid the call of the Siren.
People, it seems, will voluntarily limit their options, and even increase their discomfort, in order to help "fence themselves off" from doing the wrong thing. For example, people will actually pay the same price for a smaller portion of food, knowing the smaller serving will help prevent them from gaining weight.
The best systems, however, seem to come with a mixed load of benefits and penalties. An example: the IRA or Individual Retirement Account:
True business success may require a better mixture of wins and losses. Consider perhaps the most successful self-punishment scheme in American history — the government’s Individual Retirement Account program, under which people can invest money in retirement funds before taxes (the win), but face penalties if they withdraw the money before retirement age (the potential loss). To date, Americans have put trillions of dollars into I.R.A.s, and only a minority have made early withdrawals — one study found that between 2004 and 2005, only four per cent of adults between the ages of twenty-five and fifty-eight whose families had I.R.A.s did so.