Why not? Art. I, Sec 8 of the Constitution delegates power over immigration and borders to fedgov.
Where is fedgov delegated power to infringe on the RKBA of citizens acting legally under state law?
That is why we have courts.