In a multi-level railcar system, the formation of coalitions among railcar companies can potentially lead to a reduction in the total empty mile cost, an important part of the variable cost of the railcar system. In order to maintain a sustainable coalition, it is important to ensure that the costs incurred in the coalition will be fairly allocated to participating companies in the coalition. This paper proposes a cost allocation scheme based on game theory that allocates the cost of empty car miles to participating companies in a coalition for a railcar system. The method can ensure fairness and enhance stability of a coalition since it explicitly considers the level of contribution from each company in the coalition. The properties important for fairness in cost allocation and stability for the coalition are discussed. We have also demonstrated in the paper that the proposed cost allocation scheme can be coupled with a generalised optimisation model for empty car distribution in a dynamic railroad network.