Pro tip: “The court” interprets the Constitution and makes rulings based on that expressly stated power. How do we know? It says that in the Constitution. Article III, Section 2, Clause 1.
Keep that case in mind in regard to something similar, Trump shutting down immigration. In addition, 1902 predates the bill of rights incorporation to the states.
There is no wording in the Constitution that delegates that specific authority.
Is it legal? That’s the question. And the answer is “Yes”, not because of the Constitution, because of case law. Because of the judiciary, a lot of laws are “legal”, not necessarily Constitutional.
Then there is the 10th Amendment. Before incorporation, it is an open and shut case. With incorporation and the usurpation of state authority by the central government, not so much.
If you are going to argue the 10th in this case, I am going to argue Montana rifles.