Given the level of racism in the North is it surprising that blacks volunteered to fight in the Civil War?
Consider the impact of the NYC draft riots (where blacks were lynched) on black citizens in the North.
There were many northern and southern blacks who volunteered for the Republican army. In the South there were also many blacks who were rounded up by the Republican army at the point of bayonets and forced to join.
As concerns the northern blacks who volunteered, racist or not the North was their country and they were answering their country's call. Racist or not, it was the only country they knew. Racism was just one of the facts of life. It didn't mean that the country over-all was so bad that reasonable men would not volunteer for army service.
The northern volunteers probably felt about their country very much as the following southern slave in the Confederate army felt about his country.
"Moses of Virginia, upon being captured addressed his captors: 'I had as much right to fight for my native state as you had to fight for your'n, and a blame sight more right than you furiners, what's got no homes.' Revealed is an attachment to home and hearth, an indication that Moses saw Virginia as his native state worth defending against an outside force." This excerpt is from page 18 of Black Confederates, compiled and edited by Charles Kelly Barrow, et al. (1995). You can read parts of this book at Amazon.com.
No, it is not surprising that black soldiers were willing to fight for the North. The fact that winning the war would end slavery by far outweighed the fact that many people in the North were racist.
Consider the difference. In the North, many white people were racist and felt that blacks were inferior to them. In the South, blacks could be enslaved and made to be the property of other people. There is really no comparison between these two things -- racism is nothing when compared to actually being enslaved.
So the racism of many Northerners paled in comparison to slavery and blacks chose to fight for the North to try end slavery.