I assume if your paying with cash you wouldn't need any id at all. But usually the stores ask for some form of ID when you are paying with a credit card.
But as far as I know they sell to foreigners. Refusing to sell would get into too many questions (like whether they're a resident, visa, blah blah blah) and besides, Apple will never turn down your money.
And even if they ask for the id while using a credit card its because they want to check that its your credit card and not a stolen one. I am sure they aren't checking your id to see your nationality.