If you buy bonds you can lose money. To say they're risk free is wrong. Treasuries carry no credit risk, but they do carry duration risk. If you buy treasury bonds above par, you can also lose money even if you hold to maturity (though it would be illogical to buy them with negative yield. However we have seen this being done in Europe anyway)
Duration risk is risk. Taking on 10-30y maturity is not "risk free"
Many of these banks are holding Munis and other non-treasury bonds, which are not free of credit risk and can be worth 0 in some circumstances. I don't know about SVB's balance sheet, just speaking generally