The archive, which belonged to Gandhi's close companion Hermann Kallenbach, a German Jewish bodybuilder and architect, was to have gone under the hammer at Sotheby's on Tuesday.
The auction house had put a pre-sale estimate of between £500 000 and £700 000 ($775 000 and $1.1-million) on the collection.
But the sale was pulled after Indian authorities agreed to purchase the entire archive.
"The Gandhi-Kallenbach archive … has been sold in a private transaction to the Indian government," Sotheby's said in a statement.
The price of the sale was not disclosed.
Most of the correspondence, which spans five decades from 1905 to 1945, is from family, friends and followers of Gandhi, but there are also 13 letters written by him to Kallenbach.
They reference Gandhi's early political campaigns and the illness of his wife Kasturba.
"I no longer want to be angry with her so she is sweet … She had a few grapes today but she is suffering again. It seems to be me she is gradually sinking," he wrote in one letter.
In another, written before his return to India from South Africa, Gandhi wrote: "I do all my writing squatting on the ground and eat invariably with my fingers. I don't want to look awkward in India".
Indian historian Ramchandra Guha discovered the letters at the home of Kallenbach's grand-niece, Isa Sarid.
India has in the past complained bitterly about private auctions of Gandhi's belongings, saying they insulted the memory of a man who rejected material wealth.
Gandhi and Kallenbach became constant companions after they met in Johannesburg in 1904.
The friendship between the two men was the subject of a controversial book published last year, which suggested they enjoyed an intimate physical relationship. – AFP