In a ruling that may affect foreclosures nationwide, the Massachusetts high court has voided the seizure of two homes by Wells Fargo & Company and US Bancorp after the banks failed to show that they held the mortgages at the time of the foreclosures.