It's hazardous; buses do topple over, rooftop passengers on trains do occasionally get swept off the top by an overhanging steel rod, but they accept the risk for the free ride rooftoppers aren't in the habit of buying tickets.
People are willing to risk their lives for a free train ride.