The correct answer is:
A. to restrict the rights of African Americans and prevent them from achieving economic independence.
The Black Codes were laws passed in Southern states during Reconstruction aimed at limiting the freedoms of African Americans and ensuring their availability as a cheap labor force, thereby maintaining the social and economic hierarchy that existed before the Civil War.