There was a great youtube video explaining the reason for this (Wendover maybe?).
In short, planes are cheaper for mid to long haul because the amount of time passengers sit in them a substantially less time. Meaning the same equipment (plane or train) serviced by a single crew (pilots/flight attendants or engineer/rail attendants) can more many more passengers by plane that by rail.
A hyperbolic example of this is a cross country/continent trip. It may take a day to three to cross in train while there has only been one set of passenger tickets sold, but the train is not able to be used again until that trip ends. Further, there need to be multiple crews working around the clock for that one set of tickets sold. While a plane can sell many more tickets in the same amount of time.