Black privates also got paid $9/mon vs. $13/mon for whites. Blacks also served in the CSA Army, initially as servants, later as soldiers. For them it was a matter of homeland over politics.
The pay of African-American soldiers in the U.S. Army was raised to the salary of whites within a year or so. One of the reasons African-Americans were initially paid less was that they were not expected to serve in combat. Soon enough, African-American troops proved their fighting valor.
Until March 1865, Confederate law expressly forbade African-Americans in the rebel army, though slaves were indeed forced to dig trenches, drive mules, attend to their masters in camp, etc.