The Mississippi Black Code limited the freedom of former slaves by making it impossible for the now freed slaves to own land, make their own employment choice, and made it internally hard to leave and set out their own lives without being under the White Southers control.
Now that the slaves were freed Mississippi and other southern States feared that the slaves would rise up against them in search of revenge, that is how KKK came into form, and with the slaves now free, Mississippi plantation owners and the legislatures feared former slaves would leave their plantations which would result in loose of labor on their plantations. The purpose of the Black Codes was to do the opposite of what Mississippi and other Southern States feared of, which was to keep the slaves under control and in their place, it limited former slave movements throughout towns and as far as the former slaves trying to leave to go to other States that was impossible. The Black Codes were attempting to recreate the society that existed on the eve of the Civil War by trying to maintain white supremacy, and control of the former slaves. Mississippi and other southern States created the Black Codes to keep former slaves from leaving the communities. Vagrancy Laws, was also created included in the Black Code for unemployed and homeless slaves. Basically, with the Vagrancy Laws, the poor homeless former slave would be arrested than taken to court and fined, after that they would be taken to working camps, there they would receive housing and food and work.
In return the former slaves would stay in the camps to pay off their debts, in most cases was indefinite. Their children and wife would also be taken in and sold against the homeless slaves will and the children would work until of age which was twenty-one for males and eighteen for females. With the Mississippi Black Codes in place, for the most part it did exactly what the southern States wanted, which was to try in keep the old system of white supremacy on top and slaves in the bottom.