According to Zinn, racist attitudes played a part in the US invasion, but those attitudes were not the sole reason for that invasion. Zinn argues that the war was partly about expansion (both for nationalistic reasons and for economic ones) and partly about a desire to "civilize" the rest of the continent. However, he also says that all of these things were "intermingled with ideas of racial superiority."
Interestingly, even those who opposed the invasion of Mexico had racist attitudes. Zinn quotes Theodore Parker, a Unitarian minister from Boston who said that the US should take over the whole continent because it was racially superior (as well as being superior in other ways) to the Mexicans. He just thought that the US could have taken the area through means other than war.