The Treasury and the Departments for Transport, Environment and Communities & Local Government are the first ministries to agree cuts in a spending review intent on slashing £20bn from the cost of government.

Osborne argues that controlling £4tn of government spending over the next five years is essential to guarantee national and economic security.

The prisons announcement does not mean the Ministry of Justice has reached a wider agreement on its spending plans, however, including the future of legal aid.

The nine new jails are in addition to one already being built in Wrexham and expansions under way at HMP Stocken in Rutland and HMP Rye Hill in Warwickshire. The first prison to be sold will be HMP Reading, which was built in 1844, according to the Treasury announcement.

Osborne said details would be announced as part of the spending review at the end of November.

He said the review was about reform as much as it was about making savings. He said: “One important step will be to modernise the prison estate as many of our jails are relics from Victorian times on prime real estate in our inner cities. So we are going to reform the infrastructure in city centres and sell the estates to build much needed homes.”

The two men made the announcement before visiting Brixton prison in south London.

Gove said: “We are about to design out the dark corners which too often facilitate drug taking and violence. We will be able to build a prison estate which allows prisoners to be rehabilitated so they turn away from crime.”

In his short period as justice secretary, Gove has raised hopes among the prison reform lobby that he would be willing to reduce prison numbers and use more community punishments, but this will require taking on arguments in the tabloids that insist prison works and crimes deserve a punitive response.

Gove has already told the Howard League for Penal Reform that he hoped prison numbers would fall over time. He also said the use of body cameras would improve prison staff’s behaviour and reduce the danger of assault by inmates.

Under the influence of Gove, David Cameron told his party conference that he wanted to end the “sterile lock ‘em up or let ‘em out debate”.

Gove has also spoken of giving prison governors greater control over their prisons.