The deal for a 99-year concession for the Hammers will be announced at a news conference on Friday, when the details of the revamped stadium featuring retractable seating will be unveiled. The agreement should also open the way for the stadium to be used as a venue for the 2015 Rugby World Cup.
A senior source told Press Association Sport: "One of the things that have been agreed are arrangements that would protect the public sector should a sale of the club generate significant profit."
The negotiations between the London Legacy Development Corporation (LLDC) and West Ham have been long and tortuous since the club was named preferred bidders in December, but they have now finally been signed off by the corporation's legal advisers.
Under the agreement, West Ham will be given the right to use the stadium for all their matches under a 99-year concession deal. That will give the club long-term security but they will have no property interest in the stadium.
The deal will protect public interest should West Ham's owners sell the club for a large profit on the back of the move to the stadium - the LLDC would get a significant cut of any profit.
The LLDC will have the rights to the income from other events such as music concerts and there will also be a legacy for athletics, with a number of events for that sport maintained.
The retractable seating should allow the stadium to be changed from a football venue - with seats on the running track - to one suitable for athletics or concerts within eight days and potentially even quicker. The revamp of the stadium will cost £150million and the Hammers are expected to be there for the start of the 2016/17 season.
Sports minister Hugh Robertson could not confirm a deal had been agreed but said it made sense for a football club to be the main tenant at the stadium, and also believes the venue can be used for the 2015 Rugby World Cup.
He told Press Association Sport: "I have always thought there would be a really obvious end to this, which would be a multi-use stadium with football at its heart and that was always going to be the way to get the stadium used in post-Olympic mode. In terms of the Rugby World Cup, there is an immovable deadline and all the evidence is we'll get it done on time."