The move by the justices represents an expansion of executive power, allowing President Trump to dismantle the inner workings of a government department.