The ruling affects 130,000 cases pending before Polish courts in a dispute between banks and the borrowers of mortgages in foreign currencies.