The ruling is a victory for the German sandal maker, whose relationship with Amazon has grown increasingly antagonistic.