Yup. spies result from a large variety of motivations ranging from financial - $ - to misguided patriotism (we'll punish those libs by leaking info) to outright ideological devotion - whether that's to making sure there's a level playing field by leaking nuclear secrets (Fuchs) or helping the soviets outright due to indoctrination like the Rosenbergs....
racism is rarely the sole motivation for espionage and I'd say it's on the lower end of possible motivations in terms of occurence. A fun read is The Second Oldest Profession, tho it's dated.
Initial selections were made from several demographic POW groups, Catholics, Austrians, and those who had been assigned to punitive battalions because of their political views. Potential recruits were cleverly transitioned from the main prison population through assignment to work details. After days of observation, the candidates were given intense interviews to determine their motivation to “betray their country” by returning to Germany as American spies.
It is far easier to recruit someone already embedded in the institutions you want to penetrate then it is to train someone up, ship them over and hope they land a job with the right access.