The European Court of Justice has overturned a Spanish ruling that capped banks' liabilities for so-called floor clauses in mortgage contracts.