Bear Stearns quickly unraveled on Thursday the 13th and Friday the 14th. The Fed
determined that they couldn't let trading open on Monday with Bear Stearns still sitting in the wind. The essentially brokered a deal between the JP Morgan and Bear Stearns and acted at times as a pseudo guarantor. The thirty billion dollar figure is actually a significantly complicated financial transaction that gives the Fed plenty of potential return on its money...
What they appear to have done is to establish a limited-liability entity to take control over $30 billion worth of securities (no word yet on what the securities actually are). According to statements by the New York Fed, Morgan is responsible for $1 billion in potential losses on the $30 billion portfolio. If there are profits on the portfolio, the Fed will receive about 97% of them, and Morgan will get the rest.
It is important to again point out that the Fed routinely loans banks money. What is different here is the level of activity and involvement that the Fed chose in this situation. Keep in mind that the Fed ultimately has responsibility over the entire banking system. Clearly, in the transaction involving Bear Stearns they used that power liberally.