The war aim of the victorious North in the the War Between the States was simple -- that the Union not be divided. As Abraham Lincoln put it, the Union position was "We won't go out of the Union, and you shan't". The Northern victory was, indeed, the Union victory. Freeing the slaves was a natural outcome of that victory but was not the basic war aim.
The war aim of the Confederacy was to separate from the Union in order to preserve slavery, its "peculiar institution", an aim embedded directly in the Constitution of the Confederacy. It wished to preserve slavery because about a third of its wealth was tied up in slaves; preserving slavery would also stop freed slaves from becoming voting citizens and block freed slaves from competing for work as skilled or managerial labour. The last two aims united the interest of non-slaveowners with slaveowners.
This is why the "most whites did not own slaves" argument that the Civil War was not about slavery falls flat. No, they did not; but they still stood to lose substantially if the slaves were freed.
In the immediate aftermath of the Union victory, when Union forces occupied the defeated Southern states, voting blacks dominated the political process. But this situation rested on Union forces enforcing equal protection of the law. With the end of the Reconstruction Era, the withdrawal of Union forces and the re-integration of the former Confederate States back into the Union, white power reasserted itself. This was the era of Jim Crow, where the two subsidiary aims in preserving slavery -- to block freed slaves (and their descendants) from having voting power and competing for work as skilled or managerial labour -- reasserted themselves.
Of the three interests in creating the Confederacy -- preserving slavery, blocking black voting power, stopping blacks competing for skilled or managerial labour -- the first was lost in battle. Violence settled that issue most thoroughly. The second two were lost only temporarily, then re-asserted during Jim Crow era and only finally lost in the civil rights struggles of the 1950 and 1960s. That is when the underlying war aims of the Confederacy were finally defeated. (Not coincidentally, the defeat of the segregationist cause led to the economic resurgence of the South, as resources were no longer wasted in repression and blocking black talent.)
In the process, in their final defeat, the South came, after 130 years, to forgive the Republican Party for fighting the Civil War to Northern victory; a forgiveness consummated in the 1994 Republican Congressional victory. For a Democratic Administration -- the Kennedy-Johnson Administration -- supported the civil rights cause during its final legal victory. This use of federal power to profoundly undermine local patterns of power and status alienated many Southerners from the Democrats. First in Presidential elections and then in Congressional ones, the South increasingly voted Republican. The 2007 election of Bobbie Jindal as Republican Governor of Louisiana was both a symbol of how partisan alignments had been transformed and of how thoroughly the original Confederate cause was lost.
But also, of course, how long it took to be finally lost.