During Covid-19, New York tried to do that between PA and NY. My neighbors work in NY. They both were given "papers" proving that they worked in NY so IF the governor did close the border, they would be allowed to cross the state line.
Former Gov. Cuomo was taken to court before he could execute on this plan and was shut down by a Federal Judge using the Interstate Commerce Law, US Constitution Article I, Section 8, as his basis for his decision.