Proponents of legalizing medical marijuana can add another argument to their cause: The laws appear to save taxpayers millions of dollars.

According to a study published Wednesday in the journal Health Affairs, doctors are prescribing medical marijuana in place of medications that have been typically used to treat patients for disorders like pain, seizures, sleep disorders, depression and anxiety. The swap appears to have saved the Medicare program – whose patients include seniors and people with disabilities – $104.5 million in 2010 and $165.2 million by 2013, because doctors are prescribing other drugs less.

In other words, the government appears to spend less on drugs in states where medical marijuana is a legal option. During the time evaluated, 17 states and the District of Columbia had passed medical marijuana laws. Now, 24 states and D.C. have passed such laws. The laws vary – some specify what conditions medical marijuana can be used to treat, others require the prescription of a licensed doctor. Researchers took these factors into account in their study.

If all states had passed medical marijuana laws, authors of the study estimate, then the government and beneficiaries could save as much as $468.1 million a year. This total represents 0.5 percent of Medicare drug spending in 2013. The cost of prescription drugs – both for the government and for patients – has been an area of concern for budget analysts.

At the federal level, marijuana is classified as a Schedule I drug, meaning it has a high potential for abuse and does not carry medical benefits. Insurance companies and Medicare do not cover it, so patients pay for it out of pocket.

But patients and doctors appear to believe that medical marijuana does carry some benefits. Implementing a medical marijuana law led to a reduction of between 265 daily doses for depression and 1,826 daily doses for pain.

To conduct the study, researchers used data on prescriptions filled by Medicare Part D enrollees from 2010 to 2013. They looked at drugs for which medical marijuana was an alternative treatment, including drugs like antidepressants, muscle relaxants and sedatives, along with 17 other categories of medicines. They also included ailments that these medications treat other than those the FDA has tested them for. Such "off-label" prescribing – when doctors know a medication works to treat something it hasn't formally been approved for – is common.

Daily doses filled per doctor per year in states with and without a medical marijuana law. Courtesy Health Affairs

The drugs that treat spasticity and glaucoma did not show any link, but researchers write that for glaucoma this is likely because doctors don't think that medical marijuana is an effective treatment for that purpose, so they don't prescribe it.

As a control measure, they compared other classes of drugs for which medical marijuana is not a known replacement, including blood-thinning agents, phosphorus-stimulating agents, antivirals to treat the flu and antibiotics. They found no change in the prescribing habits for these drugs.

The study has some limitations. First, previous studies on the Medicare populations have suggested that Medicare patients make up a small percentage of people who use medical marijuana and that only 13 to 27 percent of people who used medical marijuana are age 50 or older. They admit their study cannot apply to those that are younger.

The study's authors also admit that they cannot assess whether making the switch from typical medicines to medical marijuana was necessarily the best move for the health care system. For instance, patients may request or be prescribed medical marijuana but that might not be the best treatment for them. They also write that because medical marijuana doesn't require additional monitoring from doctors, then it could limit how often patients go into the doctor, and could compromise their treatment in other areas.

Those who oppose laws legalizing medical marijuana say they have the potential for abuse, criminal activity and can lead people to use other drugs that are more dangerous. They also say that the drug hasn't demonstrated through clinical trials and approval by the Food and Drug Administration that it is effective in treating specific ailments. Other studies have suggested that medical marijuana laws cause the drugs to become available to young people and raise traffic fatalities.