WHILE Congress was gridlocked it was easy to forget how ugly the smooth functioning of government can be. After a delay of two years, a reminder came on February 4th when the Senate passed the farm bill, a strange piece of legislation which costs nearly a trillion dollars. It mixes benefits that mostly go to the poor (food stamps) with agricultural subsidies that mostly go to the rich (crop subsidies for large farms). Given a blank slate, nobody with an interest in either alleviating poverty or improving farming would construct such a law. Yet here it is again.

The alignment of rural and urban interests, which dates from when the two bits of legislation were yoked together in the 1970s, had temporarily broken down, largely thanks to some House Republicans who wished to treat food stamps (which account for 80% of farm-bill spending) and agricultural subsidies separately. They were motivated by fiscal prudence and the belief that welfare discourages work.

However, the imminence of November’s mid-term election persuaded enough Republicans to change their minds for the bill to pass. Some of those who failed to secure farm subsidies for their constituents might have been vulnerable. Another concern was the “dairy cliff”: the failure to pass a new bill would have invoked a 1949 price-support law, written when the need to produce enough milk for thirsty infant boomers was paramount, under which the government would have been obliged to buy dairy products at about twice the going rate. Even people who had trouble understanding that shutting down the government before Christmas would be politically damaging quickly grasped that doubling the price of breakfast would.

The bill passed with some pretend reforms to the food-stamps programme designed to be spouted in election campaigns, such as ending the supposed scourge of millionaires receiving the benefit. Democrats complained about savage cuts to food stamps, which actually amounted to a mere 1% over ten years compared with an earlier version. And the big picture is that food-stamp spending has exploded since 2000. The number of people receiving the benefit rose from 17m in 2000 to 26m in 2007 and then, as the recession bit, to 48m in 2013—though it is projected to shrink again as growth revives.

Those who think this expansion is a bad thing point to a study by James Ziliak of the University of Kentucky, which found that only half the recent rise was due to the stodgy economy. The remainder was caused by demographic change and a determined effort to make more people eligible, something that irks Republicans who suspect Democrats of expanding welfare to buy votes. However, Mr Ziliak, who studies poverty, likes food stamps because they are counter-cyclical.

America is unusual among rich nations in trying to tackle deprivation by giving away free food, a quirk that dates from a moment during the second world war when the government wanted people to buy up agricultural surpluses. Food stamps have high administrative costs and are open to corruption: some beneficiaries buy big packs of fizzy drinks and sell them back to the store for cash, minus the middleman’s cut. The federal government runs a confusing mess of 126 anti-poverty programmes, many of which overlap, but there is no serious talk of making the system simpler and more effective.

The part of the farm bill that actually deals with farming is even worse. Farmers are not the only people whose businesses have ups and downs; there is no reason why they should get special treatment. The new law shifts away from direct payments, by which farmers received cheques for doing nothing very much, towards an insurance model, where farmers get paid if crops fail or prices fall too far. This sounds reasonable, but the insurance schemes lock in high prices when farming is profitable, as it is at the moment: since 2008 the value of farm assets has increased by half, says the Congressional Research Service.

Crop insurance has two other defects. The first is that while the risk of crop failure or low prices is largely underwritten by taxpayers, the policies are provided by insurance companies, so, in effect, they enjoy a subsidy too. Calculations by Vincent Smith of Montana State University found that between 2005 and 2009 for every dollar in crop insurance that went to farmers, $1.44 went to insurance companies. The second problem is that crop-insurance payments are skewed towards wealthier farmers. The Environmental Working Group, which campaigns against wasteful farm spending, calculates that more than 10,000 policyholders received over $100,000 from crop-insurance subsidies in 2011. The new bill tries to cap the amount that any one farmer can receive; but if the weather is bad, it could lead to higher payouts than planned.

Sweet deals

Taken together, these subsidies distort behaviour and trade in unhelpful ways. They have created products that make no economic sense in the rest of the world, such as making sugar from corn. As a penalty for keeping cotton subsidies in place, the World Trade Organisation’s rules require the American government to pay $147m a year to compensate farmers in Brazil. The new bill is unlikely to resolve that, either.

How could Congress write such a law? One answer can be found in the register of political donations. The ten members of the House, nine Republicans and one Democrat, who accepted most money from agriculture lobbyists took in an average of $225,000 in political contributions during 2013, according to Open Secrets, which tracks donations—almost as much as some farmers received in return.