UK-based bookmaker Betfred has been chosen to buy the Tote after an auction process that began in November.
Betfred, which is paying £265m, said it would look at ways of exploiting the public body's commercial potential.
Horse racing will receive £90m from the sale and £90m will go to the taxpayer.
Betfred will take over the Tote's monopoly on pool betting at 60 UK racecourses and online, and will rebrand the Tote's 517 High Street outlets under the Betfred name.
As part of the deal, Betfred will keep exclusive control of the pool betting system on UK racecourses for seven years.
In return, it has committed to paying the racing industry £11m to March 2012, with payments of £9m a year for the next six years of the licence.
But there have been warnings that changes to the way that money is distributed could threaten the number of racetracks in the UK.
"We've got 60 racetracks. What happens is the Tote basically subsidises the smaller tracks because the money the Tote makes on any particular day is shared between all the tracks," racing journalist Neil Clark told the BBC.
"That's under threat so I fear that in, say, 10 years' time we'll have a sort of Premier League system and some of the smaller tracks will close down, which would be a great shame."
But Barry Nightingale, Betfred's finance director and the man who led the bid, said the firm was committed to the industry for the long term.
"We're investing in the Tote, we're going to be engaging with racing to create a lasting legacy and we will be involved in running the Tote for a long, long time," he said.
Betfred executive chairman Fred Done added that after the seven years were up, "there's no reason why this can't go on forever".
150 job losses
The new business will remain the country's fourth-biggest chain of betting shops with a new total of 1,350 outlets, behind leaders Ladbroke and William Hill who have more than 2,000 each and third-placed Gala Coral.
The sale is subject to consultation with the Tote's employees and is expected to be completed in about four to eight weeks' time.
The initial agreement signals the end of a 14-year attempt by governments to privatise the betting group, which employs more than 3,500 staff.
Betfred has pledged to keep job losses for the next 12 months to less than 150 of the 9,000 headcount for the new combined business. It said a lot of those job losses would be concentrated in the North West.
Betfred's main rival in the auction was Sport Investments Partners (SIP), a consortium led by the British Airways chairman Martin Broughton, which was the preferred option of many in the industry.
The Culture Secretary, Jeremy Hunt, said: "It was a closely fought contest."
The £265m sale price is about a third lower than the £400m first offered by a consortium of racecourse owners in 2007.
That was turned down by the then-Labour government because it was backed by private equity.
The consortium reformed and made another offer, believed to be about £320m, which was also rejected for not being enough.
An earlier sale attempt ended in 2006 after the European Commission said that the price was too low and tantamount to state aid.
The Tote specialises in pool betting, which differs from that offered by other bookmakers.
The Tote takes a percentage of stake money placed. Of this percentage, some is used to cover the Tote's expenses while the rest goes to the racing industry.
The bulk of the stake money is paid out to winners.
Betfred's executive chairman, Fred Done, said in a statement: "Buying the Tote has been an ambition for years, so I am absolutely delighted.
"The Tote is an opportunity I just could not miss. Over the coming months I will develop the Tote's relationship with the sport into a highly successful commercial partnership."
Betfred wants to continue using the Tote name at the UK's 60 racecourses.
Track owners have traditionally supplied marketing, accommodation and sponsorship to the Tote.
But some are said to be less happy to provide these facilities to a private company.
Those in the industry gave the deal a guarded welcome.
Paul Roy, chairman of the British Horseracing Authority, said the industry would do its best to work with Betfred.
"Our support for the SIP bid has been well documented and naturally today's announcement was not our preferred outcome," he said.
"But we will now work with Betfred and the government to ensure their commitments are delivered upon, both in relation to the Tote and other areas of industry reform."
Stephen Atkin, the chief executive of the Racecourse Association, said taking over the Tote would be a difficult task.
"Racing's customers, the punters, see it as racing's bookmaker and I think one of the challenges for Betfred - which again is a company that I do respect - is to convince punters, as well as racing, that he's going to run the Tote for the benefit of racing as well as for the benefit of his own business."
The gambling and racing minister, John Penrose, said the government had "bent over backwards to deliver a good deal for racing".
He added: "Most people can't understand why, in the modern world, the government should be even part owner of a bookie. So we pledged last year to end years of dithering and resolve the future of the Tote, and today we have done just that."
The Tote was set up 83 years ago by Winston Churchill to provide a safe haven for punters, as it was controlled by the state and beyond the reach of illegal bookmakers.