I believe it would be useful to clarify some things first:
There is no concept of "alien entities" in tax law (and by "tax" I mean specifically US federal income tax - as opposed, for example, to US federal estate tax or state and local tax law).
For individuals, there are two tax categories: citizen or alien. Alien individuals are subdivided into resident aliens and nonresident aliens.
Legal entities can (generally) be either "domestic" or "foreign". It depends in large part on the legal form of the entity. If it is a "corporation" established under laws of one of the US states, it's treated as a domestic corporation. If it's an entity established elsewhere, there's a whole sub-discipline dedicated to determining whether that entity is treated as a "corporation" for tax purposes. If it is, it is considered a foreign corporation. (I will pass over partnership/LLC, other passthrough/transparent entities, trusts, etc. - you will need a PhD to deal with those...)
So focusing on nonresident aliens and foreign corporations - these are generally subject to tax in one of two situations: if they have a "US trade or business" or not.
If they do have a "US trade or business" (that's a 2nd PhD right there), they have to determine if they have income which is "effectively connected" with that "US trade or business" (yet another PhD is required for that). If that exists - the foreign corporation/nonresident alien is subject to tax on that income. And there are industry-specific rules on top of that: taxing a banking business is not the same as taxing a game development business.
If there is no "US trade or business", a foreign corporation/nonresident alien is subjet to tax on certain categories (not all) of "US source income" (a mini PhD).
And, yes, if a tax treaty exists between the US and the "country of residence" of the foreign corporation/nonresident alien (yup!), these results will likely change.
This is a long and winding way of saying that there is no way to answer a hypothetical question like this: it's a really complex issue, which can't be intuited or answered from some sort of first principles.