If a state law allows the use of medical marijuana but federal law prohibits it, the state law violates: The supremacy clause of the Constitution
The supremacy clause indicates that in an event where a Federal law and a state law contradict one another, the federal law must be held at a higher standard than the state law