The decision was 5–4, with Chief Justice John Roberts joining the court’s three liberal justices in dissent.