The prime rate increase from 10 1/2 percent to 11 percent that spread rapidly across the nation's banks yesterday had been anticipated for weeks.

The cost of funds at most lending institutions had been rising steadily since the spring, squeezing the net interest margin, which is the difference between what a bank pays for its funds and the rate at which it lends them. That margin is the main source of revenue to most banks.

Administration officials began to predict an increase in the prime lending rate more than a month ago, citing the rise in the cost of funds in the open market where banks purchase many of the funds they lend to business borrowers.

Some observers said yesterday that banks might have held off announcing a prime rate increase until the House of Representatives took action on an increase in funding for the International Monetary Fund. The boost in the U.S. contribution to the international rescue agency, approved by the House last week, was viewed as crucial to managing the debt crises in a number of developing countries such as Mexico, Brazil and Argentina.

Banks, which have billions of dollars in loans to troubled debtor countries, did not want to give fuel to IMF opponents in the House, who already had branded the IMF bill a bank bail-out, the reasoning goes.

But experts said the primary factor in the boost was not political but economic. Bank costs have been rising since May, while the prime rate had remained at 10 1/2 percent since February, although a few banks in Texas and Florida raised their prime rates last week.

According to a study by the investment banking firm Salomon Brothers Inc., during the first three months of the year the difference between what banks paid for a key source of their funds (90-day certificates of deposit) and the prime rate was 235 basis points. A basis point is 1/100th of a percentage point.

During the second three months of the year, the difference between the 90-day certificates and the prime rate had narrowed to 174 basis points, or by more than half a percent.

The federal funds rate, the interest banks charge each other for overnight loans, averaged less than 8.6 percent in late April. It was nearly 10 percent yesterday.

The overall net interest margin at major banks declined to an average of 2.83 percent during the second quarter, compared with 2.92 percent during the first three months of the year. For domestic loans the spread was 1.79 percent, Salomon Brothers reported.

The spreads were far smaller than that by last week.

Bankers said yesterday that while the IMF bill may have been a consideration for delay at some big banks--like Citibank, which was among the first to raise its prime--other factors played a bigger role:

* Loan demand has been very weak, especially at major New York and Chicago banks that are the major lenders to business. "It's hard to raise prices when demand isn't there," the chief of lending for a major institution said recently.

* Many banks felt the rise in market interest rates--although more than a percentage point--was temporary. But the continued prospect of large federal borrowing coupled with little indication that the Federal Reserve was prepared to relax the monetary tightening it imposed last May may have convinced banks that an increase in interest rates was needed to restore some of the net interest margin, an analyst said yesterday.

* Despite the squeezing of margins, most banks were able to keep their profits up during the second three months of the year, easing the pressure on bank managements to raise the prime rate--always a politically difficult decision.

As recently as two weeks ago, John McGillicuddy, chairman of Manufacturers Hanover Trust Co., the nation's fourth biggest bank, cited those reasons and others in predicting that banks would not find it necessary to raise their prime rates.

But McGillicuddy said he would change that prediction if what he thought was a "blip" in short-term rates appeared to be more permanent. Yesterday his bank joined others in boosting its prime rate to 11 percent.