I'll take the bait..
> Why is it not okay to discriminate on the basis of race or gender but okay to discriminate on the basis of citizenship/country of birth?
Because, a country and it's city, and infrastructure have been built by money spent on by a bunch of people who paid taxes. For a another country, person to come in enjoy the infrastructure, make money and compete with the ones who paid for the infrastructure is unfair by design.
I am somewhat sympathetic to this argument but only with the following revisions.
An adult foreigner coming to the US has, if anything, better fiscal implications for the US than the children of American citizens since children need are very likely a net fiscal negative for say the first 18 years of their lives. New Americans, whether they are formed by birth, or by immigration enjoy the existing infrastructure without having paid for it.
If you say that American parents have already paid taxes on behalf of their children then I'll say that American employers have already paid taxes on behalf of their foreign employees. I'm fine with having a consistent 'entry fee' for all new Americans as long as said entry fee applies uniformly to both children of Americans and foreigners who wish to immigrate.
Because, a country and it's city, and infrastructure have been built by money spent on by a bunch of people who paid taxes. For a another country, person to come in enjoy the infrastructure, make money and compete with the ones who paid for the infrastructure is unfair by design.
Disclaimer: I'm an Indian working in India.