The decision is a victory for Trump and setback for federal judges who sought to check the check the president’s power.