All four companies who entered into the bidding process will be reimbursed for the costs.
Transport Secretary Patrick McLoughlin said: "I want to make sure what lessons need to be learnt from what went wrong, with this have not been repeated in those particular franchises."
When asked how much it would cost to reimburse the costs of the companies who entered into the bidding process, he replied: "We estimate that to be in the region of about £40million."
Mr McLoughlin said the cancelling of the West Coast Main Line rail franchise award was "wholly and squarely" down to a Whitehall fault.
Louise Ellman, chairwoman of the Transport Select Committee, raised concerns about the costs.
She said: "It is clear there are major costs to the taxpayer of this major error.
"If the mistake hadn't been found at this stage – and it has only been found because of questioning of the Department and because of the threatened court action – there would have been massive costs to the taxpayer in the future, and also possibly to passengers as well who might not have had their rail services."
Mick Whelan, leader of the train drivers' union Aslef, said: "Taxpayers and rail passengers will be handed a £40m bill because the Government is too pig-headed to recognise that rail franchising is unwieldy, expensive, bureaucratic, wasteful, imprecise, unscien- tific and, ultimately, indefensible.
"A serious study of alternative rail financing involving the workforce, companies, users, politicians, rail experts and any other stakeholders is urgently needed.
"Franchising has failed us all. It would be wrong to simply look at what went wrong this time.
"It is the whole process that is flawed, not this particular bid."