There have been claims and counter-claims about the amount of money that Revenue & Customs (HMRC) has made or saved for the exchequer.

The prime minister has quoted a figure of £160bn since 2010, but the shadow chancellor, John McDonnell, dismissed that figure, saying: "It looks as though they have extrapolated from one figure over the full period of their office."

HMRC has given some details of how this figure is calculated, and it certainly is not just an extrapolation over seven years from a single figure. The 2016-17 figure for this was £28.9bn.

There are many assumptions and estimations on the way to the final figure. HMRC has provided a breakdown of how it is calculated.

The first part of the figure, which is the most likely to be accurate, is the amount that HMRC has recovered in taxes. There is a certain amount of estimation involved if cases have not yet been concluded, but the figure is basically accurate. It was £10.3bn, more than a third of the total in 2016-17.

The next part is the amount of money that HMRC reckons it would have lost if it had not intervened, which was £7.9bn last year. That's things such as disrupting criminal activity and rejecting fraudulent claims for repayment.

Trying to estimate how much money would have been made by a criminal activity had it not been disrupted is clearly an uncertain business.

The next part is how much HMRC reckons it will benefit from changes to tax law, which was £3bn last year.

Handily, this figure is checked by the Office for Budget Responsibility (OBR), which assigns a level of uncertainty to the figures.

So, for example, in the Spring Budget this year, the government introduced new penalties for "enablers of tax avoidance". The OBR said that the prediction for the amount of money this would save was of high uncertainty, with the assumptions about how behaviour would change having very high uncertainty, which is the highest rating.

The OBR points out that when you try to change the behaviour of people who are trying to avoid tax, they are fairly likely to just try to avoid tax in other ways instead.

There have been more than 100 measures announced since 2010 that have tried to reduce avoidance. The OBR has looked back over the estimates of how much money they would raise.

It found that the estimates were as likely to be too low as too high, but that the changes that were supposed to raise the most revenue were more likely to underperform.

Predicting the future

Next up is £6.3bn of "future revenue benefit", which is the benefit that HMRC predicts it will get in future years as a result of its current interventions, changing the behaviour of taxpayers in the future.

Putting a value to the amount of money the exchequer will make next year because some tax avoiders have been prompted by a high-profile tax case to pay their taxes in full can never be a precise activity.

But HMRC only includes an intervention here if it can provide clear evidence that a taxpayer is likely to change their behaviour. And of course this isn't necessarily money that HMRC has raised since 2010 - it's money it expects to raise in the future.

Having said that, such an effect clearly does exist - people who have had to pay extra tax because they have made errors in their returns are more likely to get it right in future years.

On the other hand, there may be an effect that the calculations are missing, which is that changes in tax rules may open up new loopholes that allow people to avoid paying their taxes. Alternatively, changes or interventions may prompt companies or individuals to spend more on advisers and taking actions to reduce their tax liabilities.

Finally, there is £1.3bn from Accelerated Payments notices, which is how much money HMRC reckons it will make as a result of its requirement that some people using tax avoidance schemes have to pay the disputed amount up front while adjudication is taking place.

There are also penalties for people who do not settle their cases with HMRC if cases similar to theirs go the government's way.

Clearly, there is a great deal of estimating and predicting behind these figures. It is clear that more money has been raised for the exchequer than would have been if HMRC had done nothing, but the overall figure over seven years should not be seen as more than an estimate.

Read more from Reality Check

Follow us on Twitter