Answer :

in my opinion the black codes were established to ensure the Northern Union that the Confederates, even after that Civil War, did not believe
abolitionism. so in a way the southerners wanted to let the northerners know they still want to fight but because they do not have the manpower left, they wanna fight politically and that they still didn't believe "all men are equal" this is part of the reason why i think the Reconstruction did not work out and that it eventually led to the civil rights movement in 1950's/1960's which ended the entire dispute
 Black codes were established to ensure the Northern Union that the Confederates