In a 3-0 ruling, court says Trump administration misread a decades-old immigration law to justify mandatory detention.