If you need to change the mileage for any reason, this is perfectly legal. It is however, illegal, if you knowingly sell the vehicle without informing the buyer of its true mileage.
To protect buyers we place stickers showing that the mileage was corrected.