A federal program set up in the mid-1960's to help states raise money for low-interest student loans has backfired into an unexpected bonanza pouring profits of more than $40 million in federal dollars this year into state treasuries.

Congressional analysts, who are preparing a report for the Congressional Budget Office on the guaranteed student loan program, estimate that a loophole in the federal tax law could provide a profit of up to $1 billion in federal funds to states and local agencies connected with the program by 1985.

In addition to the congressional study, a federal grand jury in Denver has been gathering information about some aspects of the program in Nebraska, and questions of conflict of interest have been raised concerning the program in several western states.

State officials in California said yesterday that a bill under consideration there to set up a federally guaranteed low-interest student loan program could end up substantially benefiting six members of the state legislature. The legislators are all directors of a nonprofit corporation that has applied to run the program.

According to the Congressional Budget Office report, which is scheduled to be released within the next few weeks, profits that have accrued to the states involved already in floating student loan revenues bonds are largely due to unexpectedly high interest rates on U.S. Treasury bills.

States are reimbursed for student loans at a 7 percent interest ceiling by student borrowers. In addition, the states also receive a supplementary federal reimbursement pegged at 3.5 percent below the prevailing three-month Treasury bill rates.

This means that under prevailing high-interest rates on Treasury bills states may end up with returns of up to 16 percent on their student revenue bonds.

For years, however, Treasury bill interest rates remained low, and the student revenue bond program labored along in virtual obscurity. Only a handful of states took any substantial interest in floating the bonds.

Two factors changed that.

In 1976, Congress amended the federal tax reform act to benefit states issuing student revenue bonds. Federal law generally prohibits states from issuing tax-exempt bonds -- which because of their exemption carry low interest rates -- and investing the proceeds in assets that yield a higher return. But the tax revision in 1976 eased that restriction in the case of bonds designed to raise money for student loans.

The second factor was the steep climb in interest rates on Treasury bills in the last two years. Profits soared on student revenue bonds, which were tied to treasury bill interest.

According to the Congressional Budge Office analyst, states' returns on student loans last year ran between 13 and 16 percent. This year states in the program stand to make about 16 percent interest on their student revenue bonds and federal supplements, the CBO study said.

Projected over the life of the bond issues, the returns from the program can be substantial. The congressional analysts estimated that North Dakota, which has a $79 million student revenue bond issue, will get a $5 million surplus. Wisconsin, which has $40 million out in the student revenue bonds, will get a $4 million profit.

Since profits on the program began to climb 18 states have floated student revenue bonds issues. Eight more states are expected to do so for the first time this year. The total volume of bonds floated has jumped almost 500 percent in the last two years, congressional analysts said.

In 1976 tax revisions also broadened the category for participants in the loan program. Under an amendment submitted by Sen. Lloyd M. Bentsen (D-Tex.), any nonprofit corporation can buy up student loans made under the program if the corporation is operated exclusively to acquire student notes and is organized at the request of a state or other political subdivision.

Federal and state experts expressed concern in interviews this week that the Bentsen amendment could lead to a flood of new student revenue bond operations around the country.

For example, the experts noted that any college short of cash could approach its local council or even sewer authority and request it to establish the school as a nonprofit corporation to buy up student loans under the program.

So far, the only political subdivisions except states which have taken advantage of the Bentsen amendment have been four local authorities in Texas. Several other cities and counties in Texas and other states are planning to get into the program.

The Texas Legislature recently established a special committee to look into possible improprieties in the student revenue bond program there. The Texas attorney general's office has also been asked to rule on potential conflicts of interest among some participants in the bond program.

In the California case, lawmakers have started to examine a bid by a nonprofit corporation to run the student loan bond program if a bill to establish such a program is passed by the state legislature.

The bill would allow California Gov. Edmund G. (Jerry) Brown, Jr. to choose a private nonprofit corporation to sell tax-exempt bonds to finance the student loan program.

The owner of a private two-year college in Sacramento and a lobbyist for the school recently put together the corporation and appointed six state legislators to its 11-member board of directors.

Under the bylaws of the nonprofit corporation the directors would be able to vote themselves salaries and benefits out of the federally assited loan revenues. Organizers said they planned to amend the bylaws after reporters' inquiries this week.

A similar federally assisted student loan revenue bond program in Nebraska has also come under federal scrutiny. The program is run by a nonprofit corporation called the Higher Education Loan Program (HELP.)

In an interview yesterday the president of the corporation, Guy L. Saunders, said he is employed by the corporate parent of a Lincoln, Neb., bank holding more than 60 percent of the student loans owned by HELP. n

Saunders said he also heads a corporation that owns 25 percent of the student loan pool at the Lincoln bank.

In addition, Saunders said he sits on the board of directors of a Denver firm paid by HELP to administer the loans. The Denver company is 75 percent owned by the Nebraska bank where Saunders is employed, and 25 percent owned by a third corporation he directs.

Before taking the job with HELP in June 1976 Saunders was vice president of the Labor Finance Industrial Bank of Denver. Last August the bank and several of its senior officers pleaded guilty to fraud charges in connection with the federally assisted student loan program.

Saunders was not involved in the charges.