Boeing probably added another $100-200,000 to the cost of the next 787 off the assembly line (or one of its military contracts) to cover the cost of the flight.
Boeing is a private sector corporation. So long their planes are selling like hot cakes, they can add whatever they can get away with.