I agree that the two aren't exactly the same, but public transport users have a right to safe, comfortable, unobstructed travel. There's a difference between preventing a class of people from using public transport to travel, vs preventing everyone from using public transport to sleep.
I also note that the case of long distance travel is an exception, because you might legitimately need to sleep at a station between legs. I'm talking about people who sleep in train stations with no intent of travelling anywhere.