Criminal proceedings brought after the Hatfield rail crash are estimated to have cost about £8m, the Old Bailey has been told.
The crown court trial lasted eight months
Network Rail, formerly Railtrack, and maintenance firm Balfour Beatty, will be sentenced on Friday for breaching health and safety regulations.
Mr Justice Mackay is hearing evidence to help him decide how much of the trial cost should be paid by the firms.
Four people died when a London to Leeds express train derailed in October 2000.
Network Rail was found guilty of an offence under the Health and Safety at Work Act after an eight month trial.
Balfour Beatty admitted an offence under the act, although it does not accept all the facts of the case the prosecution had outlined against it.
The trial heard the 117mph crash, which also left 102 people injured, was caused by a cracked section of the track.
A backlog of essential work had been allowed to accumulate, and the rail had been identified for repair 21 months earlier, the jury was told.
Prosecutors said the crash resulted from a "cavalier approach" to safety.
The crash left Railtrack with a £733m bill for repairs and compensation to train-operating companies and helped trigger its collapse. Network Rail took over the running of the rail system in 2002.
Three ex-Railtrack managers and two former employees of Balfour Beatty, the firm which maintained the line, were cleared at the same trial.
During the trial, Balfour Beatty and the five rail executives were formally cleared by the judge, Mr Justice Mackay, of manslaughter.
On Tuesday, prosecutors dropped the case against four Balfour Beatty workers still facing charges over the crash.