The South was extremely short of food and medicines, and PWs were on the hind teat for that.
Prisoners were exchanged or paroled until 1863 when the North stopped the practice, having calculated that the South was a net beneficiary from it.
Federal prison camps could have been humanely run, but few officers had much interest in doing so and it was seen as retaliation for the conditions in Southern PW camps.