Getting ahold of psychedelic drugs is neither easy nor cheap—especially if you’re a scientist. Academic research on psilocybin, the key “magical” ingredient in magic mushrooms, has taken off in recent years thanks to studies that have found it a promising treatment option for depression and addiction (as well as more abstract, less health-focused findings, such as that psychedelics create the sense that the self is an illusion.) Scientists who want to study the drug, though, have to go through a lengthy and expensive process to obtain it.

Matthew Johnson, a psychiatry and behavioral sciences professor at John Hopkins University who’s conducted extensive research on psilocybin, says he and his colleagues pay between $7,000 and $10,000 per gram. The typical street price for magic mushrooms is $35 per eighth of an ounce, so $10 per gram. To be fair, those hoping to get high recreationally typically buy dried mushrooms rather than pure psilocybin. Though it varies, 5,000 mg of dried mushrooms roughly equals 66 mg of psilocybin. Academics, though, are still paying over 13 times the price of the drug as its sold on the street.

That high cost is due in part to the processes involved in synthesizing a form of psilocybin that meets standards set by the US Food and Drug Administration’s Good Manufacturing Practice (GMP) regulations. Johnson says the chemists who create the drugs have never given him a line-item breakdown of exactly where all the money goes, but they do say that absolutely everything is tested and retested. The people doing the work, the chemistry procedures used to synthesize the compound, the purity of pre-cursors, and the equipment being used in the manufacturing process all have to meet certified standards.

As a result, there’s little commercial incentive for companies to make psilocybin and, in the past, many researchers have turned to academic medicinal chemists, such as the now-retired David Nichols, formerly of Purdue University.

In January 2017, Compass Pathways, a company backed by Peter Thiel, created the largest supply of GMP-standard psilocybin—250 grams—that had been made in over 50 years, according to co-founder and chief medical officer Ekaterina Malievskaia. The approval process was arduous, Malievskaia says; it took the company six months to synthesize psilocybin in a powder form that would meet GMP standards for drug trials.

At first, Compass followed a process previously outlined by chemists to synthesize the drug from scratch—rather than extracting it from magic mushrooms. It’s possible to do both to GMP standards, though extracting the drug creates “an unnecessary layer of complexity,” Malievskaia says. The problem was that those synthesis processes had previously only been used to create small amounts of psilocybin. Compass wanted to create enough the stuff to be able to provide it on demand for other academic drug trials.

Drugs used for research purposes have to be tested extensively before they’re given to trial participants, which means they have to be created on a scale large enough to be tested at each stage. It’s not enough to test a batch and then create similar batches using the same process: Every individual batch has to be extensively tested to meet GMP standards.

Much of Compass’s first 250-gram batch of psilocybin powder was used in testing the product. With the leftovers, they then had to get the powder into 1mg and 5mg capsules, making sure that the chemical didn’t change during the encapsulation process and that their measurements were precise. “This process is also very stringent and labor-intensive and very expensive,” Malievskaia says.

Compass said their capsules cost £20 each, but this only reflects a portion of the total cost paid by academics. The company works with a distribution partner, Fisher Pharmaceuticals, which charges for packaging and shipping. Robin Carhart-Harris, head of Psychedelic Research at Imperial College London, said his team paid around £20,000 for enough psilocybin for a study involving 50 volunteers when he obtained the drug through Compass and Fisher. In comparison, it cost around £30,000 for 20 patients for an earlier trial where he did not buy the drugs through Compass.

Compass provides psilocybin at no charge to members of European College of Neuropsychopharmacology, and so Carhart-Harris said the payment goes to Fisher Pharmaceuticals rather than Compass. Fisher Pharmaceuticals did not respond to requests for comment and Compass refused to put Quartz in touch with their business partner.

Johnson points out that the regulatory burden has a chilling effect on the entire industry. “The overall regulatory process is too restrictive,” he says. “That drastically limits the companies that would be willing to make it commercially because that’s a whole specialty in itself. Unless you deal in Schedule 1 compounds [the drugs under the highest level of US Drug Enforcement Administration restrictions] you’re not as likely to want to take this on, because it has its own challenges and requirements.”

Currently, Johnson says, it typically takes academics around a year to get psilocybin for their studies, as they wait for local institutional review board approval, FDA approval, and DEA approval. Few scientists have the necessary knowledge and experience to go through the process and acquire the drugs.

Many of the restrictions are necessary to ensure a safe standard of drug, says Johnson. But as there’s increasing demand to study the drugs, he expects more companies to manufacture it and the costs to go down. “Like anything else in the economy, I would expect volume to have an effect on price,” he says.

This article has been updated to reflect more detailed costs of acquiring psilocybin through Compass.