We analyse maintenance cost data for Swedish railway infrastructure in relation to traffic volumes and other characteristics, and separate the cost impact from passenger and freight trains. Lines with mixed passenger and freight traffic, and dedicated freight lines are analysed separately using both log-linear and Box-Cox regression models. We find that for mixed lines, the Box-Cox specification is preferred, while a log-linear model is chosen in the case of dedicated freight lines. The cost elasticity with respect to output is found to be higher for passenger trains than for freight trains. From a marginal cost pricing perspective, freight trains are currently paying too much, while passenger trains should be charged more. An adjusted pricing scheme based on these results would still lead to higher revenues than today if total demand is unaffected.