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.
A rooftop ticket is sold at a discounted rate from a regular one because of the increased risk of traveling.