In this case, the act in question is the Controlled Substances Act, which makes a whole host of drug offenses federal crimes. It was ruled constitutional [2] in the early 2000s, in response to a challenge from California pot growers obeying the local medical marijuana laws who were raided by the DEA.
That is supposed to be the mechanism by which to decide these questions; go to the Supreme Court. However, it turns out that even if states don't actively prevent the feds from enforcing drug laws, most of drug enforcement is in fact done by local police. If the SFPD isn't going to arrest you for smoking joints or selling potklava in Dolores Park, what's the federal government going to do? Put DEA agents on patrol on street corners in SF? Which leaves the federal government in the situation of having declared something illegal, but without having anywhere near the resources to enforce those laws - and the states passively encouraging disobedience of those laws.
Welcome, young folk, to the USA's first real-life (if small) constitutional crisis since Watergate!
[1] Leaving aside the conflict between constitutional law and regular law.
[2] Under the Commerce Clause, which I think is a bit of a stretch, but hey, that's the Commerce Clause for ya