As the sun went down on West Ham’s hopes of ending their last season at the Boleyn Ground with a trophy on Wednesday, a rainbow appeared behind the East Stand, arching over the Chicken Run. And it couldn’t help but appear to point to the pot of gold in Stratford that many have long suspected West Ham secured in their 99-year agreement to move into the Olympic Stadium from next season.

Thanks to the dogged determination of a Charlton Athletic fan, latterly backed by a coalition of 14 supporters’ trusts from across the country, we now know on exactly what terms West Ham will lease the stadium.

While it was easy to understand why one side argued for full transparency on the terms of the contract – the vast majority of the £701m spent on the stadium has come from the public purse – it was hard not to conclude that the reason for the London Legacy Development Corporation’s reticence was not commercial, as it claimed, but old-fashioned embarrassment.

Those who have followed the twists and turns of this saga since it was decided at a fateful meeting of the Olympic board in 2007 to snub football and effectively park any decision on the future of the stadium until after the Games will be familiar with the bare bones of the deal.

But to see it written down in black and white confirms again what a leg-up West Ham’s joint majority owners, David Gold and David Sullivan, and canny vice-chair Karren Brady (rumoured to have got a sizeable bonus for landing the deal) have received.

They argue, quite reasonably, that without them the stadium would be facing an uncertain future and ongoing subsidy. But they also know they have landed a stupendous deal.

In bald terms, LLDC will take on all of the running costs from the corner flags to the stewards in return for £2.5m a year in rent (reduced by half in the event of relegation) and a one-off payment of £15m.

West Ham keep all their ticket revenue while other income streams are shared. Over the first two decades of the stadium’s life, the LLDC will pocket the first £4m of any naming rights deal on the iconic stadium and share anything over that 50-50 with West Ham.

In the small print, it also emerges that West Ham will get a 40% reduction in their rental terms after 20 years if they choose to forego their share of naming rights revenue. Alternatively, they can stick with the existing agreement. As elsewhere, the dice seem loaded in West Ham’s favour.

The Hammers will, of course, argue that their presence will vastly boost the price and therefore they deserve to share in the upside. Critics may say they’re getting a pretty good deal already.

The same principle applies to catering revenue. The LLDC will keep the first £500,000 per year, but will share anything after that on a 70-30 split. West Ham will contribute to triggering that £500,000 level by paying the LLDC’s contractor for hospitality catering.

The LLDC might consider itself quite pleased with performance-related bonuses that guarantee, for example, an extra £100,000 if West Ham finish 10th. If the club were to win the league, the bonus payments would tot up to just over £1m. Or, to put it another way, around eight weeks’ wages for Dimitri Payet. And given that the bottom club in the Premier League next season will receive at least £100m in TV money alone, it starts to look less of a bonus for the taxpayer.

Taken as a whole, the 207-page document also underlines the extent to which the stadium is to all intents and purposes West Ham’s for the duration of the football season. Up to now, it has suited both tenant and landlord to insist the contract is for just 25 days a year.

The LDDC promises in the section on naming rights that the stadium “shall retain the look and feel of the home ground of West Ham United Football Club during the football season without limitation”.

Ultimately, the details of the contract confirm everything we suspected.

One, that between them the various agencies responsible for the stadium made a complete Horlicks of planning for its post-Olympics future.

Two, that once the political decision had been taken to seek a Premier League football club as a tenant and, crucially, to keep the running track then the LLDC had little option but to go to West Ham and try to strike whatever deal it could.

Three, that Gold, Sullivan and Brady have got themselves the deal of the century. It is difficult to disagree with Arsène Wenger when the Arsenal manager said inheriting the stadium was like “winning the lottery”.

When it opens at the beginning of the 2016-17 season, the new 60,000-capacity stadium will seem airy and impressive to some, insubstantial and windswept to others. It has been almost entirely rebuilt since the summer of 2012 to make it suitable for both athletics and football.

The skirmish over the release of the contract has become just one more postscript in the Great Olympic Stadium Mystery. All the main protagonists, from the London mayor Boris Johnson to West Ham to the LLDC to the Newham Mayor Sir Robin Wales, at various points said they were relaxed about publication. Yet still the LLDC resisted, racking up legal bills.

Meanwhile the future intentions of Gold and Sullivan have come under scrutiny since they bought the club. Both insist they will not sell but the prospect that they might cash in on their good fortune prompted Johnson to belatedly agree a deal to claw back some money if they did.

The mechanics are outlined in an annex and will deliver a percentage of the purchase price over £125m to the LLDC provided the club is sold within the next 10 years.

The mechanism is complex but if the club were sold for £250m within the first five years of the move, the LLDC would receive £12m. If the sale price were £300m, then £27m would flow back to the taxpayer and if the sale price were £500m, the proceeds would jump to around £87m. Between five and 10 years after the move, the sums decrease.

The publication of the document was a victory for transparency but is unlikely to be the end of the saga. The coalition of 14 supporters’ clubs said they would begin poring over the document to understand “its costs to the taxpayer, and to football, and any further implications”.

Steve Lawrence, who worked on the original concept for a London Games in 2003 and retains long-held concerns about the deal, said there could still be implications for the argument over state aid rules.

And Jonathan Isaby of the TaxPayers’ Alliance said: “You can’t blame the club for taking advantage of the ludicrously generous taxpayer subsidy they’ve been handed on a plate; instead we should be directing our anger and awkward questions at those responsible for offering a deal for which most clubs would have sold their star striker.”

Meanwhile the former Leyton Orient owner Barry Hearn, another standby in this tale of cock-up and conspiracy, said his dog could have negotiated a better deal for the taxpayer.

None of which is likely to concern West Ham, who continue to insist the deal is beneficial to all parties. They may have lost on Wednesday night but the full extent of their crushing victory off the pitch has now become clear.