Yes. Except like the case in Montana of a Med MJ grower busted by the fed, he was not allowed to tell the jury that what he was doing was legal under stste law. Or many gun cases where the defendent is not allowed to bring up the second amendment as a defense. If you are not allowed to mount a defense, it is hard for the jury to side with you.
In some cases jury instructions practically direct the jury to convict.