Because we outlawed railroad strikes but didn't outlaw airline strikes.
Doesn't really prevent a strike though: it just makes it cost more. Here in Massachusetts it's illegal for public school teachers to strike, yet it has happened a couple times in the last year. In one case the teacher's union was fined: https://www.bostonherald.com/2023/02/08/woburn-teachers-turn...