If you have a redirect on domain A, that redirect to domain B, it can spider pages on domain B and they will appear in Google as they would be on domain A.
EDIT: Doesn't have to be a blatant redirect. You could have the 404 page set to
http://domainB.com, which is in fact a redirect.