Note, that Jim Crow was enacted not immediately after the Civil War but after the reconstruction period[3]. The aftermath of reconstruction involved a period of racist terror where the Ku Klux Klan and other forces effectively engaged in a guerilla campaign that restored white supremacy in the South.
[1] https://en.wikipedia.org/wiki/Jim_Crow_laws
Except that key provisions of the act were struck down in 2013. Those provisions prevented states with a history of disenfranchisement from changing their voting laws. Since the court ruling several of these states have started back on the path of disenfranchisement.
Many of these laws existed before the Civil War, and were simply "updated" to replace the word "slave" with "freedman".
Other laws cleverly redefined common terms, introducing technical language, so that they could claim that a former slave, forced to work for little or no pay, was "serving an apprenticeship" or "being punished for vagrancy". E.g., a slave in reality, but "on paper" an apprentice, a volunteer, serving a criminal sentence, etc.
Black Codes also severely limited the ability of black citizens to gather and organize, required impossible "literacy tests" to vote, and prevented black citizens from owning any type of weapon, either outright:
Louisiana: "No freedman shall be allowed to carry firearms, or any kind of weapons."
Or via a "may issue" licensing scheme:
Alabama: "Freedmen must not carry knives or firearms unless they were licensed so to do."
[1] https://en.wikipedia.org/wiki/Black_Codes_(United_States)