A Maryland savings and loan obtained $20 million in new mortgage funds from the state's pension system yesterday, the first commitment in the nation under a plan developed by the Federal National Mortgage Association to enable home buyers to tap into the vast pool of investment capital held by public and private pension funds.

Gov. Harry Hughes said the money would enable Loyola Federal S & L of Baltimore to issue approximately 350 mortgages on new homes in Maryland. Loyola is the state's largest federally chartered S & L, with more than $1 billion in mortgages outstanding. It has seven offices in Montgomery and Prince George's counties.

Hughes said the pension fund would receive a "healthy return" on "a secure investment." Officials of Loyola and Fannie Mae Federal National Mortgage Association said the pension fund will receive 16 percent interest on its investment and will not be subsidizing home buyers at the expense of pensioners.

The mortgages will be made available to home buyers at either 15 percent or 13.5 percent, depending on the purchase arrangements, Loyola said. Home builders will be obliged to absorb the difference, as they are already doing on many loans.

A Fannie Mae spokesman said the Loyola commitment was the first of what is expected to be a multibillion dollar series of mortgage investments by pension funds. The nation's public and private pension funds hold about $600 billion in assets, according to a recent report by the President's Commission on Housing, and Fannie Mae expects them to be a major source of funds for the hard-pressed housing industry throughout the 1980s.

The nationwide shortage of mortgage funds, partly caused by the withdrawal of billions of dollars from the low-interest savings accounts that have traditionally been the source of funds loaned by the S&L's, has crippled the housing industry because builders have been unable to obtain loan commitments.

Pension funds have traditionally been reluctant to invest money in home mortgages because such loans require a knowledge of local real estate and involve a great deal of paper work. Under the Fannie Mae program, however, the pension funds will not issue mortgages. Instead, they will buy marketable, federally insured securities issued by Fannie Mae, and Fannie Mae will channel the funds back to the S & Ls.

The pension funds controlled by public agencies were able to invest in the Fannie Mae securities as of yesterday, when Fannie Mae issued its first commitment. Private pension funds, which control about two-thirds of all pension assets, have been generally precluded by federal regulations from investing in home mortgages. The President's Commission on Housing, however, recommended in January that the rules be changed to permit investment in the kind of securities Fannie Mae is now issuing, and a Labor Department spokesman said yesterday that the department was "working feverishly" on doing so.

Maryland Comptroller Louis Goldstein, board chairman of the state employes' retirement system, said he hoped the state's commitment would spur other Maryland pension funds, such as those of county workers, to make similar investments.

Thomas R. Marvel Sr., vice president of Loyola's loan division, said he had already approached Montgomery County and the City of Baltimore with proposals for injections of mortgage money.

Fannie Mae officials said the agency would issue securities to finance any mortgage commitment by any pension fund, with no ceiling on the nationwide program.

An official of the D.C. Retirement Board said his agency, which acquired investment independence from the federal government last year, has not yet developed a long-term investment policy and is not yet prepared to make any commitments. In Virginia, Gov. Charles S. Robb said during his election campaign that he supported the use of state pension funds to aid the housing industry.

"We are tapping into a badly needed pool of capital," Loyola's Marvel said in a telephone interview. "We have been working with the state retirement system for about a year, trying to build some kind of acceptable plan. We offered to sell them loans, or participation in a pool of loans, but they didn't have the staff to deal in individual loans.

"So we said, okay, how about securities. But the problem was that securities issued by a local S & L had little marketability. If they wanted to sell them in a year, they couldn't find buyers. So we started talking to Fannie Mae."

Fannie Mae's traditional approach to housing finance has been to buy mortgages issued by lenders and hold onto them, raising capital through the sale of short-term notes and debentures, which were not backed by any specific pool of mortgages. The new securities will be backed by the specific mortgages issued with the funds raised by the sale, and Fannie Mae will charge a fee of one quarter of a percent per year.

According to Marvel, the loans to be made available will be 30-year mortgages, but the interest rate will be subject to renegotiation every five years. If the rates rise, the home buyers will have the option of continuing to pay at the new rate or paying off the loan and obtaining new financing elsewhere. If the rates go down, the home buyer benefits by a corresponding drop in monthly payments, he said.

The availability of pension capital for mortgages could provide a badly needed stimulus to the housing industry, though the interest rates may limit the number of buyers qualified for loans.