Ah, but they don't know if it's a foreigner until they look at it. So might as well collect it all and figure out which ones are the foreign ones later. After all, the data's not actually "collected" until an analyst looks at it. It's a sort of Heisenberg-data - only exists when you look at it. While it's sitting in the NSA data centre, it's entirely harmless!
That's the keyword there.
> for intelligence and counterintelligence purposes and to support military operations
This is meaningless without oversight.