What with a former peanut-company owner, Stewart Parnell, being sent to prison for knowingly selling salmonella-tainted peanut butter, and Volkswagen’s C.E.O., Martin Winterkorn, resigning after revelations about the cheat software in the firm’s diesel-powered cars, it took a special magnitude of corporate misbehavior to make the business-news headlines in the past couple of weeks. But Martin Shkreli, the C.E.O. of Turing Pharmaceuticals, managed it when his company said it was raising the price of a sixty-two-year-old lifesaving drug from $13.50 to seven hundred and fifty dollars a pill. The move quickly became a major scandal; Shkreli was called “the most hated man in America.” Yet the true scandal of Turing’s profiteering scheme was that it was entirely legal.

Daraprim—which is used to treat toxoplasmosis, a condition that afflicts AIDS patients, among others—first came on the market back in 1953, so it has long since gone off patent. But what Shkreli recognized was that, even with a generic drug, regulatory barriers and a lack of competition can make big price hikes possible. In Daraprim’s case, only one company had regulatory approval to sell the drug in the United States. So, in August, Turing bought those rights. Shkreli knew that, in principle, other companies could produce their own versions of Daraprim. But it seemed a fair bet that none of them would try. The market for Daraprim is small—eight to twelve thousand prescriptions a year in the U.S.—and any company that wanted to enter the market would have to go through the expensive and time-consuming process of getting F.D.A. approval. As it happens, several companies already make and sell a generic version of Daraprim abroad, but they weren’t a worry, either, because they, too, would have to jump through the F.D.A.’s hoops to sell it here. Turing loaded the deck even further in its own favor by insisting on a model of “closed distribution” for the drug, restricting access to patients, doctors, and a limited number of distributors and pharmacies. In the unlikely event that another company wanted to produce Daraprim, it would be hard to buy enough of the drug to reverse-engineer.

Essentially, Shkreli is exploiting rules devised to protect consumer safety in order to create a virtual monopoly and then charge whatever he wants. Monopolies are inherent to the drug industry in the U.S.: patents, in effect, are temporary monopolies. But we have patents because they give drug companies an incentive to invest in developing new drugs. There’s no such justification in the case of Daraprim. Turing’s price gouging does not reward innovation and it doesn’t reflect the cost of production. In the United Kingdom, Daraprim sells for less than a dollar a pill.

Turing’s business model is a quintessential example of rent seeking: increasing profits not by adding real value for customers but by exploiting loopholes. And, unfortunately, Turing is not alone. Last year, another company run by Shkreli acquired the rights to a kidney-disease drug called Thiola and raised the drug’s price twentyfold. In 2011, K-V Pharmaceutical got F.D.A. approval to market a synthetic hormone that had been used for decades to prevent preterm births. Once K-V got approval and exclusive rights, it raised the price from around fifteen dollars to fifteen hundred dollars an injection. There have also been alarming increases in the prices of common drugs like doxycycline. Generic-drug makers have been merging with each other, leaving fewer competitors. “Without price competition, the generic model fails,” Gerard Anderson, a professor of public health at Johns Hopkins, told me. “Without competition, there are no market forces that limit price increases.”

That doesn’t mean there’s nothing to be done. In place of closed distribution, the F.D.A. can require companies to make samples of their drugs available to competitors. The F.T.C., as Anderson argues, should be more aggressive in limiting mergers among generic-drug makers. And the U.S. and other developed countries should also adopt an arrangement known as regulatory reciprocity: if a drug maker has approval to sell a drug abroad, it should be able to sell that drug here, and vice versa. Safety concerns may rule out importing drugs from just anywhere, but there is no good reason for a company selling a drug in, say, Germany to have to spend time and money to get the right to sell it here. Foreign competition has played a central role in holding down retail prices in industries ranging from automobiles to consumer electronics. It’s time drug prices were subject to the same rules. Shkreli has said, since the backlash, that Turing will roll back the Daraprim price increase. But the fate of toxoplasmosis sufferers shouldn’t depend on the egomaniacal whims of a “pharma bro.”

Of course, these kinds of measures would make drug companies anxious, but they should be doing all they can to encourage competition, if only out of self-interest. If market forces and smarter regulations can’t limit price gouging, then drug makers could be subject to more drastic measures, like price controls or compulsory licensing—a system that compels companies to license drugs to other manufacturers. The Turing scandal has shown just how vulnerable drug pricing is to exploitative, rent-seeking behavior. It’s fair enough to excoriate Martin Shkreli for greed and indifference. The real problem, however, is not the man but the system that has let him thrive.