Psilocybin and psilocin are Schedule I controlled substances under the federal Controlled Substances Act of 1970, meaning federal authorities classify them as having no accepted medical use and a high potential for abuse. Both claims are at odds with the clinical literature; the scheduling has not caught up.
Federal law applies in every state, on federal property, and in interstate transport. A state can decide not to enforce possession or cultivation under its own laws — as Oregon and Colorado have — but federal agencies (DEA, FBI, U.S. Postal Inspectors) retain jurisdiction. In practice, federal prosecutions of small-scale personal use have been rare; federal enforcement focuses on trafficking, interstate commerce, and activity on federal land.
Spores themselves — which contain no psilocybin — occupy a narrow federal gap and are legal to possess federally for microscopy purposes, though a handful of states (CA, GA, ID) specifically criminalize them.