As I understand it, the unconstitutionality of the initial executive order was based on the balance of power in the US government. Doing this kind of thing by executive order is not allowed. Doing this kind of thing by passing a law through Congress is allowed. The Constitution gives a lot of power to the legislature, especially given the interpretations of the Commerce Clause over the history of the US.