Pre-Civil War!
Indiana and Illinois had such laws, other states did not. But I would suggest that the law's actual effect was less to expel freed slaves, than to reduce slave-catchers roaming their states in search fugitives they could return South. This law allowed those northern states to officially declare: "no fugitive slaves for you to catch here".
To be fair, there were some northern states that passed black-codes and anti-miscegenation laws both pre and post Civil War. They ere typically border states that did inherit "the problem" by virtue of proximity. The reasons as well as the scope of these laws varied from state to state and were chiefly in response to events such as Prigg v. Pennsylvania and Dred Scott v. Sandford. The south had established cultural "norms" for negro behavior that the north had no reason to adopt - until circumstances were thrust upon them.
Some states, like the states of Indiana and Illinois were frank and blunt: "we don't want you here". All telegraphed a similar sentiment: "we don't know what to do with you".
Ironically, blacks who violated the law faced punishments that included being advertised and sold at public auction. It is important to note that attitudes regarding blacks were hardly solidified anywhere except the south. Some communities saw so few of them they were regarded as curiosities. Many (most?) were wary of them and passed laws to discourage their immigration. White supremacy was still an unabashed aspect of most communities north and south. Don't forget that the Plessy v. Ferguson decision on "separate but equal" segregation was rendered in 1896!
It's also important to keep in mind that northern states began to roll back those black-codes almost as quickly as they passed them. With the exception of Indiana, the North was free of anti-miscegenation laws by 1887. Southern Jim Crow laws persisted and even survived Brown v. Board of Education and the problematic 1965 Civil Rights Act.
What’s interesting is that, despite these laws on the books, a large black population developed in Illinois. The 1860 census counted nearly 8000, a number exceeding that of most of the confederate states.
So did all Southern states.
I appreciate you taking the time to respond, however my life is so busy at the moment that I am unable to spend any more time on long debates. Truly sorry about that. The debate was fun while it lasted, and maybe we can pick it up again some other time. For now we will just have to agree to disagree, ok? :-)