The decision is a defeat for medical marijuana advocates who had lobbied successfully in 10 states to allow marijuana use for medical reasons.
Justice John Paul Stevens, writing the 6-3 decision, said that Congress could change the law to allow medical use of marijuana.
The closely watched case was an appeal by the Bush administration in a case that it lost in late 2003. At issue was whether the prosecution of medical marijuana users under the federal Controlled Substances Act was constitutional.
The ruling is a serious setback not only for proponents of medical marijuana who say it is helpful for serious and chronic pain, but also for states' rights, reports CBS News Correspondent Bob Fuss.
Ten states have legalized medicinal marijuana — eight by direct votes of the people — but the federal government arrests and prosecutes patients who use it and the Supreme Court has now ruled they can continue to do so, reports Fuss.
Under the Constitution, Congress may pass laws regulating a state's economic activity so long as it involves "interstate commerce" that crosses state borders. The California marijuana in question was homegrown, distributed to patients without charge and without crossing state lines.
Stevens said there are other legal options for patients, "but perhaps even more important than these legal avenues is the democratic process, in which the voices of voters allied with these respondents may one day be heard in the halls of Congress."
California's medical marijuana law, passed by voters in 1996, allows people to grow, smoke or obtain marijuana for medical needs with a doctor's recommendation. Alaska, Colorado, Hawaii, Maine, Montana, Nevada, Oregon, Vermont and Washington state have laws similar to California.