Any law needs to be enforced to be effective. Essentially you need some sort of police who can bring the people who break the law to justice. But usually a police agency is only allowed to enforce certain parts of the law. So your local neighbourhood cop is not allowed to go after you for tax fraud, this is what the IRS is for. The US have taken the division of police agencies to an extreme compared to other countries so you have thousands of police agencies each responsible for their own laws and/or their own territory.
Marijuana is illegal on a federal level in the US. There are technically no states where it have been legalised. But the way drug enforcement is done is that the FBI can only enforce drug crimes across state lines while the local and state police can enforce drug crimes within their state. There are no federal agency who can normally arrest you for selling marijuana unless you crossed state lines to do so. The states where marijuana have been made “legal” have just ordered the police to not enforce marijuana crimes. So while it is still technically illegal there are no police who are allowed to arrest you.
Latest Answers