Because it is a federal law and up to the federal government to enforce it. States cannot be required to enforce federal law for the federal government. The Supreme Court decided that back in the 1850's.
You’re exactly right. This is also why local sheriffs had the legal authority to refuse to arrest people who violated the Federal assault weapons ban in the 1990s.
And apparently, States can't voluntarily help enforce Federal law if the administration in power dislikes those laws. Remember that Obama's DOJ successfully sued Arizona for trying to enforce Federal immigration law on its border.
My apologies, because I did not clarify my response very well. That link shows the Federal law that to aid and abet Illegals is a crime . That includes harboring and assisting them. Therefore, these mayors and governors have broken Federal law, yet nothing is done.