Yes, federal law still applies for those in the transportation industry.
Many airlines had to fire a whole bunch of their employees in Colorado, for example, when those employees tested positive for marijuana after Colorado enacted their law.
Airlines are very careful to explain to employees that while controlled substances like marijuana may be legal to consume in the state of Colorado, federal law applies to their job, that they can be tested at any time, and testing positive for marijuana will result in immediate termination.
I’m not aware of any pilots who were in this position, but certainly it applied to many ramp workers, as well as flight attendants.
The people working at airport concessions all have badges, so they're not supposed to consume alcohol 8 hours before duty. I suppose even people working at airport bars serving alcohol. There's irony for ya.