BACK in 1980, when Jimmy Carter was president and leg warmers were cool, America spent 9% of GDP on health care. Now it spends a whopping 17%—far more than any other rich country. In absolute terms it spends more than twice as much per head as Britain. And for what? American figures for diabetes, infant mortality and life expectancy are worse than the median for the OECD, a club of rich countries.

For decades health spending has grown faster than the economy as a whole. The soaring cost of health insurance provided by employers has left little or nothing in the pot for pay rises. Out-of-control public-health programmes such as Medicare and Medicaid have threatened to crowd out everything else that Uncle Sam pays for.

Yet something appears to have changed. America is experiencing its slowest growth in health spending in five decades. In 2013 the share of GDP devoted to health care was the same as it was in 2009. Some of this is due to the recession and its aftermath—when Americans lose their jobs, they often lose their health insurance, too. But the Affordable Care Act of 2010, better known as Obamacare, may also have helped to curb costs. As the Supreme Court considers whether to strike down a crucial pillar of that law (see next article), economists are furiously debating how big that effect has been. By one estimate the economic downturn accounted for 77% of the dip in health-care inflation; by another, it was only 37%.

Obamacare sought to fix two problems: coverage and cost. To extend coverage, the law made it compulsory for Americans to have health insurance, on pain of a fine. It also offers subsidies for those who cannot afford it and bars insurance firms from charging people more if they have “pre-existing conditions”; ie, they are already ill. Before the exchanges arrived in 2013 some 41.3m Americans lacked health insurance. That has fallen to 30m (of whom 48% are eligible for assistance).

Curbing costs is more complicated. Traditional American health care is inefficient and wasteful. Costs vary enormously from provider to provider—sometimes by an order of magnitude—and until recently were largely opaque. Medical bills were long paid by third parties, such as insurers, so patients neither knew nor cared whether one option was cheaper than another. Under the “fee-for-service” system every blood test, bandage or X-ray triggers a payment. Doctors are tempted to order lots of unnecessary procedures to pay for a new yacht or their children’s education.

Obamacare introduced (or encouraged the adoption of) various tools to restrain all this. For example, health-care providers receive financial rewards for cutting costs and penalties for bad care, such as when patients have to be readmitted to hospital after they have been discharged or when they catch nasty infections in a clinic. Between January 2012 and December 2013 there have been 150,000 fewer readmissions among Medicare patients—an 8% decline. The law also requires greater price transparency.

Doctors and hospitals are encouraged by the law to club together in Accountable Care Organisations. Instead of charging fees for everything they do, most ACOs try to keep people healthy. Obamacare rewards them for keeping costs below a set limit per person covered. Not everyone is convinced that ACOs—which strongly resemble the unpopular Health-Maintenance Organisations of the 1990s—will work: Regina Herzlinger of Harvard Business School calls them a “fantasy” because they are so difficult to manage.

Stop shovelling cash out of the door

The health law encourages the use of “bundled payments”, where a hip replacement or a heart bypass generates a single fee, no matter how many tests are performed or how many complications arise. These bundles may also help to cut spending on drugs, says Paul Keckley of Navigant, a consultancy. When hospitals cannot simply charge extra for each pill, they are more likely to haggle for discounts with the drug firms that supply them.

On January 26th Sylvia Burwell, the health secretary, said she hoped that by the end of 2016, 85% of Medicare’s payments would have some link to value and quality (as opposed to simply shovelling money out of the door willy-nilly), and almost a third will be via ACOs or bundles. Private insurers such as Anthem, Aetna and United HealthCare are following suit.

The amount that Medicare spends on each beneficiary has actually declined in real terms, from $12,000 in 2011 to $11,200 in 2014. If this is sustained, it could make a huge difference. Medicare has long been the most frightening part of the federal budget. Falling Medicare spending could be driven by falling demand—lots of baby-boomers have just turned 65, and they are healthier than their elders. But it could also be because hospitals and doctors are working more efficiently. A paper by the Congressional Budget Office suggests that over the previous decade providers were trimming costs, for example by treating beneficiaries at lower-cost clinics, adopting more efficient procedures and introducing new technology more slowly.

Much of the American health-care system still clings to fee-for-service. But towards the end of the past decade doctors, hospitals and other providers surely saw Obamacare on the horizon. Anticipating changes in the way hospital payments are updated each year, they realised they would have to shape up. Anecdotally, they have been preparing for years. New evidence from the journal Health Affairs suggests that hospitals grew more productive between 2002 and 2011—particularly after 2009 (see chart). Chapin White of the RAND Corporation says that the fall in Medicare spending in hospitals last year was worth $98 billion, for which Obamacare can take some credit.

Overall the CBO projects that, if the law is unchanged, net federal spending for the government’s main health-care programmes in 2039 will be 8% of GDP, about 15% less than had been projected in 2010. Projections for Medicare and Medicaid spending between 2011-2020 have been revised downwards by $1.1 trillion. The government also claims that since 2011 some 50,000 fewer patients died in hospitals as a result of Obamacare.

Far from bankrupting the nation, as its critics predicted, Obamacare may be making medicine thriftier. Even so, health-care spending as a share of GDP is likely to rise over the next decade as Americans age. With the economy recovering this year, the total health-care bill is projected to grow by 6%. Hold the champagne, then, and not just because it is bad for you.