When we talk about health care, more than any other public policy area, we talk about morality. It’s easy to understand why: health care, its quality and availability, affects us and our loved ones deeply. When illness strikes, the ability to afford good medical care—and the policies that affect that affordability—can truly be a matter of life and death.

Last week, former UN Secretary General Ban Ki-moon decried the American health-care system as immoral because it has yet to follow Europe down the path to socialized medicine. As if to echo that judgment, Nostrum Laboratories pharmaceutical executive Nirmal Mulye defended his company’s decision to raise the price of an antibiotic from $474.75 to $2,392 a bottle, calling it a “moral requirement to make money when you can . . . to sell the product for the highest price.”

Neither man is entirely correct—but Mulye is closer, scandalous as that sounds. To the extent that pharmaceutical companies have a moral obligation, it is to provide lifesaving drugs to as many people as possible. In many cases, doing so requires charging a lot for drugs up front. Setting a high price for a new drug isn’t immoral; it’s sometimes necessary to keep the wheels turning on the world’s most innovative pharmaceutical industry.

Consider that 90 percent of drugs that get tested for potential human use don’t make it to market. In other words, pharmaceutical companies must rely on the 10 percent of drugs that do clear the hurdle to recoup their investments. When you factor in R&D costs with this high failure rate, the average cost of bringing a new drug to market comes out to around $2.6 billion. For drug makers, this figure always looms large. Before a company begins putting in the time and money required to bring a new drug to market, it must assess whether it has a reasonable shot at recouping its investment down the line. The price of a drug just coming on to the market reflects this concern.

Mulye is certainly not acting with an eye toward future innovation; Nostrum’s drug, nitrofurantoin, has been on the U.S. market since 1953. Like Martin Shkreli, the infamous “Pharma Bro,” Mulye is simply price-gouging, taking advantage of a drug shortage to profit off of patients. But not every drug company is run by pharma bros. As long as there are markets, there will be price-gougers, con men, and cronies trying to take advantage. Anger at a few bad actors shouldn’t be the guiding force for policymaking. We can give government the power to reject price increases and otherwise micromanage pharmaceutical companies—but that level of regulation comes with consequences. With too many barriers to recouping their investments, pharma companies will stop taking risks, and innovation will suffer.

Besides, in most cases, price-gouging is not the cause of high drug prices. Take the example of Sovaldi, the breakthrough cure for hepatitis C, released by Gilead in 2014. With its list price of $84,000 for a course of treatment, Sovaldi prompted an outcry from activists, lawmakers, and patients, but it inspired something else, too—competition, in the form of two follow-on drugs that came to market in the next two years, the cheapest of which cost just over $26,000.With two competitor drugs on the shelves, the market kicked into gear. As Gilead lost profits, it lowered prices. Last year, a patient on Medicaid could get one of Gilead’s hepatitis C drugs for about $10,000. Last week, Gilead announced that it would begin selling authorized generic versions of two of its hepatitis C drugs, Epclusa and Harvoni. With a list price of $24,000 each, they sell for 68 percent and 62 percent less than the original formulary prices, respectively—and $2,000 lower than the cheapest competitor currently on the market.

Of course, $24,000 is still a lot to pay for a drug, but these are list prices, before discounts, rebates, and—most important—insurance. Cost-sharing varies widely among insurers, not to mention Medicare and Medicaid. One study found that a low-income Medicare enrollee could pay as little as $10.80 out of pocket for a full course of hepatitis C treatment.

The release of these affordable generics doesn’t prove that Gilead is more altruistic than any other pharmaceutical company. It does prove the importance of market competition as a force for lowering drug prices. With few exceptions, most high drug prices are temporary reflections of an economic calculus. Competition can quickly alter that calculus. Lowering drug prices, then, is a question of markets, not morals. To strike the right balance between innovation and access, we need policies that encourage competition, not more regulations that let the government interfere with private industry. The more we can empower drug companies to compete with one another to see who can provide the best medicine to the most patients at the lowest price, the better off American health consumers will be.

Photo by George Frey/Getty Images