The figure – published by the SFO following a Freedom of Information Request – includes the original investigation and all of the subsequent court cases, with more than a third being spent on (£2.6m) on lawyers.
Former Tesco finance director Carl Rogberg, former food commercial director John Scouler and former managing director Chris Bush were originally charged with fraud and false accounting.
These charges came in the wake of the 2014 accounting scandal involving the supermarket chain, in which Tesco was found to have overstated its profits by £250m.
Scouler and Bush were acquitted in December, after judge John Royce ruled there was no case to answer.
As part of its deferred prosecution agreement (DPA) – agreed between the chain and the SFO and signed off by the high Court in 2017– Tesco paid £3m towards the total costs.
Prime minister Theresa May wanted to abolish the independent SFO by incorporating it into the National Crime Agency in 2017, but scrapped the manifesto pledge after losing a majority in the General Election.
May also attempted to shutter the SFO twice before this while in her previous role as home secretary.
In March last year, the SFO was in discussion with the Treasury over how it will be funded in the future, during which the then director-general David Green defended the authorities funding arrangements.
In her first speech as director of the SFO in September last year, Lisa Osofsky said she was committed to maintaining the agency’s independence and the “prominence of this organisation”.