The Federal Reserve’s second-largest loan program is going to cost taxpayers $2 billion, the central bank said Friday.

    The Federal Housing Finance Agency said the loan is designed to repair the mortgage market and that it will be paid back by the Fed through a discount on its asset purchases in the near term.

    The program has been in the works since October.

    The central bank says it is the largest program of its kind since the Fed’s first attempt in the mid-1990s.

    It’s expected to cost $1.2 trillion to repair, the Federal Housing Administration said.

    Under the program, the Fed will buy $2 trillion of Treasury bonds to finance mortgage insurance programs.

    FHA has $1 trillion in mortgage insurance.

    The Fed has a $1 billion cushion.

    Banks will get loans from the Treasury, Federal Reserve and banks.

    Banks will also receive an emergency funding buffer, a temporary guarantee that will help them absorb losses from a sudden drop in prices.

    Some of the money will be repaid with interest from the Federal Reserve.

    But that cushion will dry up, the FHA said.

    That will reduce the total amount of money the FHFA can borrow.

    This program is not designed to serve as a buffer to the housing market, the agency said in a statement.

    As of September 30, there were nearly 7 million foreclosures in the United States, up from about 5 million in the fourth quarter of 2014.

    “We will continue to work with the Federal Deposit Insurance Corporation to support the financial stability of the U.S. financial system through the creation of a liquidity buffer that will protect against a severe housing downturn and support our economy as we recover,” the FHSA said.