The foreign aspect isn't conclusive with respect to UBTI. There are various ways that investment vehicles can be structured, but here's a common arrangement:
US investment fund ("US Fund") is the primary investment entity.
The offshore fund ("Offshore Fund") is an indirect investor in the US Fund. In other words, the purpose of the Offshore Fund is to ultimately invest in the US Fund, which makes the investors in the Offshore Fund indirect investors in the US Fund.
A blocker vehicle is formed ("Blocker Vehicle"). Whereas the US Fund and Offshore Fund may both be see through entities (e.g., limited partnership) where tax is assessed at the limited partner level, the Blocker Vehicle will usually be a non-see through entity (usually a corporation). The Blocker Vehicle is an investor in the US Fund
The Offshore Fund invests through the Blocker Vehicle, i.e., the Offshore Fund gives money to the Blocker Vehicle, and the Blocker Vehicle invests in the US Fund. When the US Fund distributes money, it gets distributed to the Blocker Vehicle; the Blocker Vehicle then distributes money to the Offshore Fund.
Since the Blocker Vehicle is not a see through entity, the Blocker Vehicle pays taxes on the distributions from the US Fund (usually at the corporate rate), and anything left after taxes are paid is sent to the Offshore Fund. Since the Blocker Vehicle is the "investor" in the US Fund and already paid taxes, the Offshore Fund's investors generally are not treated as engaged in anything giving rise to UBTI.