Nitrogen fixing bacteria consume NH4 from air or water. The soil is simply a medium it can attach to and grow. While air is composed of 78 to 79 percent diatomic nitrogen, nitrosomas and other nitrogen fixing bacteria consume ammonia not the N2 (relatively inert form) from air, water and soil. Often ammonia is found in low concentrations in these "mixtures". Nitrogen fixing bacteria convert ammonia into nitrite then nitrate, "organic compounds."
Best wishes, I hope this helps.
