I agree that the Fed is the lender of last resort, but when part of the bailout involves absorbing loans that should not have been issued, then it also did a bad job at overseeing risk by lending institutions. Part of the blame goes to Congress, but the Fed should have said something about this.
If we had 100% reserve banking we wouldn’t need a lender of last resort. Instead we have fractional reserve banking (usually at 10%) which is a recipe for disaster. It makes loans easier to get, but that isn’t necessarily a good thing.
The goal of the Treasury will be to have the bad loans written off before they buy the securities. It’s not an exact science, but that’s the goal. And the intent isn’t to bail out, but to remove these toxic assets from the system, so institutions can get back to their normal financial functions.