The Bank of England and government worked all night to secure a deal involving no taxpayer money.