Yes, but until such time as it gets off the earth is the most convenient source of atoms, and being that you're on the surface at the bottom of a big gravity well you're pretty convenient.
How so? Sure, there's a significant upfront cost to sending a rocket out to the asteroid belt, but you only have to do that once. Once there's a base with a radio antenna, machine intelligences can travel back and forth at the speed of light.
And once you're in the asteroid belt, you have a huge amount of unclaimed raw material, unlimited space, and no gravity well to get in the way.
Machines don't need food & water, they need fuel. The universe has lots of that.