It also reduces your actual salary by £40k, not just for tax purposes, if you'll never end up using your full pension. Either because you've died before doing so, or because the pension fund can't pay you out (fully) since it is increasingly underfunded due to a rapidly aging society.
Answer this honestly for yourself: if you are fairly young, say 25-35, what are the odds you'll see more money in your lifespan from £40k put into a pension now that may or may not be fully available after retirement, versus £40k minus tax invested into an index fund and accessible/reroutable whenever?