Skyrocketing price tags for new drugs to treat rare diseases have stoked outrage nationwide. But hundreds of old, commonly used drugs cost the Medicaid program billions of extra dollars in 2016 vs. 2015, a Kaiser Health News data analysis shows. Eighty of the drugs — some generic and some still carrying brand names — proved more than two decades old.

Rising costs for 313 brand-name drugs lifted Medicaid’s spending by as much as $3.2 billion in 2016, the analysis shows. Nine of these brand-name drugs have been on the market since before 1970. In addition, the data reveal that Medicaid outlays for 67 generics and other non-branded drugs cost taxpayers an extra $258 million last year.

Even after a medicine has gone generic, the branded version often remains on the market. Medicaid recipients might choose to purchase it because they’re brand loyalists or because state laws prevent pharmacists from automatically substituting generics. Drugs driving Medicaid spending increases ranged from common asthma medicines like Ventolin to over-the-counter painkillers like the generic form of Aleve to generic antidepressants and heartburn medicines.

Among the stark examples:

Ventolin, originally approved in 1981, treats and prevents spasms that constrict patients’ airways and make it difficult to breathe. When a gram of it went from $2.58 to $2.90 on average, Medicaid paid out an extra $54.5 million for the drug.

Naproxen sodium, a painkiller originally approved in 1994 as brand-name Aleve, went from costing Medicaid an average of $0.72 to $1.70 a pill, an increase of 136 percent. Overall, the change cost the program an extra $10 million in 2016.

Generic metformin hydrochloride, an oral Type 2 diabetes drug that’s been around since the 1990s, went from an average 10 cents to 13 cents a pill from 2015 to 2016. Those extra three pennies per pill cost Medicaid a combined $8.3 million in 2016. And cost increases for the extended-release, authorized generic version cost the program another $6.5 million.

“People always thought, ‘They’re generics. They’re cheap,’” said Matt Salo, who runs the National Association of Medicaid Directors. But with drug prices going up “across the board,” generics are far from immune.

Historically, generics tend to drive costs lower over time, and Medicaid’s overall spending on generics dropped $1.6 billion last year because many generics did get cheaper. But the per-unit cost of dozens of generics doubled or even tripled from 2015 to 2016. Manufacturers of branded drugs tend to lower prices once several comparable generics enter a market.

Medicaid tracks drug sales by “units” and a unit can be a milliliter or a gram, or refer to a tablet, vial or kit.

Old drugs that became far more expensive included those used to treat ear infections, psychosis, cancer and other ailments:

Fluphenazine hydrochloride, an antipsychotic drug approved in 1988 to treat schizophrenia, cost Medicaid an extra $8.5 million in 2016. Medicaid spent an average $1.39 per unit in 2016, an increase of 347 percent vs. the year before.

Depo-Provera was first approved in 1960 as a cancer drug and is often used now as birth control. It cost Medicaid an extra $4.5 million after its cost more than doubled to $37 per unit in 2016.

Potassium phosphates — on the market since the 1980s and used for renal failure patients, preemies and patients undergoing chemotherapy — cost Medicaid an extra $1.8 million in 2016. Its average cost to Medicaid jumped 290 percent, to $6.70 per unit.

A shortage of potassium phosphates began in 2015 after manufacturer American Regent closed its facility to address quality concerns, according to Erin Fox, who directs the Drug Information Center at the University of Utah and tracks shortages for the American Society of Health-System Pharmacists.

When generics enter a market, competition can drive prices lower initially. But when prices sink, some companies inevitably stop making their drugs.

“One manufacturer is left standing … [so] guess who now has a monopoly?” Salo said. “Guess who can bring prices as far up as they want?”

According to a Food and Drug Administration analysis, drug prices decline to about half of their original price with two generic competitors on the market and to about a third of the original price with five generics available. But if there’s only one generic, a drug’s price drops just 6 percentage points.

The increases paid by Medicaid ultimately fall on taxpayers, who pay for the drugs taken by its 68.9 million beneficiaries. And those costs eat “into states’ ability to pay for other stuff that matters to [every] resident,” said economist Rena Conti, a professor at the University of Chicago who co-authored a National Bureau of Economics paper about generic price hikes in July. The manufacturers’ list prices for the drugs named here also rose in 2016, according to Truven Health Analytics, which means customers outside Medicaid also paid more.

Conti said that about 30 percent of generic drugs had price increases of 100 percent or more the past five years.

Medicaid spending per unit doesn’t include rebates, which drug manufacturers return to states after they pay for the drugs upfront. Such rebates are extremely complicated, but generally start at the federally required 23.1 percent for brand-name drugs, plus supplemental rebates that vary by state, Salo said. Final rebate amounts are considered proprietary, he noted. “All rebates are completely opaque … [it’s] “black-box stuff.”

Fox said drug prices could also jump when a pharmaceutical product changes ownership, gets new packaging or just hasn’t had a price increase in a long time.

Recently named FDA Commissioner Scott Gottlieb has made increasing generic competition a core mission. Plans include publishing lists of off-patent drugs made by one manufacturer and preventing brand-name drugmakers from using anti-competitive tactics to stave off competition.

Doctors, pharmacists and patients don’t always receive warning when a price hike is about to occur, Fox said.

“Sometimes, we will get notices. Other times, it’s like a bad surprise,” she said, adding that the amount of wiggle room for alternatives depends on the drug and the patient.

Following some price hikes, doctors can use fewer units of a drug or switch it out entirely, she said.

Ofloxacin otic, long used to treat swimmer’s ear, became so expensive when generic manufacturers exited the market that doctors started using eye drops in patients’ ears, Fox said.

When old drugs get more expensive, hospitals try to eliminate waste by making smaller infusion bags and keeping really expensive drugs in the pharmacy instead of stocked in readily available shelves and drawers. But that’s not always possible.

“These drugs do have a place in daily therapy. Sometimes they’re life-sustaining and sometimes they’re lifesaving,” said Michael O’Neal, a pharmacist at Vanderbilt University Medical Center. “In this case, you just need to take it on the chin, and you hope one day for competition.”

Methodology Note: The KHN analysis is based on drugs whose per-unit spending increases drove Medicaid costs up by at least $1 million in 2016. We calculated extra expenditures for each drug by first determining how much it would have cost Medicaid to reimburse the number of units purchased in 2016 at the 2015 unit cost. We subtracted this from the actual total cost in 2016. The total extra expenditure for a drug includes the sum of the extra expenditures for all its versions (represented by NDC codes), accounting for various strengths, package sizes, routes and labelers. Reimbursement levels vary by state and are typically based on a drug’s list price.

KHN’s coverage of prescription drug development, costs and pricing is supported in part by the Laura and John Arnold Foundation.