In a grim report, the agency attributed the second-quarter loss for the banking industry to a surge in bad loans made to home builders and commercial real estate developers.