A key ruling from Europe's top court has upheld Germany's ban on purely financial investment in law firms.