The law is clear except for one part:
Section 212(f) of the Immigration and Nationality Act, which gives the executive broad authority to suspend or restrict “the entry of any aliens or any class of aliens” if their entry “would be detrimental to the interests of the United States.”
Except that isn't what they were doing.
The president's team used the same reasoning above in this case as they did in the travel ban. They won that travel ban case. It could have gone either way and was far from judicial activism on the conservatives' part or a stupid thing to try to do.
The travel ban case was a very different matter governed by different laws and very different facts. They aren't at all analogous.