It's been established that police in the US have pretty broad discretion in terms of being permitted to lie. If you ask an on-duty police officer if something is legal, can they lie about that?
I know there is a previous question that asked "Can the police lie about whether I am compelled to do something?" but I am asking "Can the police lie about whether I am permitted to do something?"
For example, say you're visiting a state where you're unfamiliar with local laws, and by some strange coincidence there is someone giving marijuana samples, but there is also a police officer nearby. If you ask the officer, "Is it legal to have small amounts of marijuana here?" could the officer say "It's fine. Go for it!" but then arrest you anyway?
Note, I do not use marijuana. That just seemed like the clearest example of something where laws vary greatly from state to state.