In this context "the United States" means the federal government. States are also within the jurisdiction of the state government, and therefore not within the exclusive jurisdiction of the United States.
This is the exact same reason why the US president can only pardon federal crimes.
Whoever, in any Territory or District, OR within or upon any place within the exclusive jurisdiction of the United States
(Capitalisation for emphasis by me.)
The crime depicted is a federal one under US law.
Title 18 lacks a Definitions section that I can find.
> The term “U.S. Territory” means American Samoa, the Commonwealth of the Northern Mariana Islands, Guam, the Commonwealth of Puerto Rico, or the U.S. Virgin Islands.
https://en.wikipedia.org/wiki/Territories_of_the_United_Stat...
And there's plenty of references to legal documents clearly stating or implying that territories are in fact not sovereign entities (e.g. https://en.wikipedia.org/wiki/Puerto_Rico_v._Sanchez_Valle)
And obviously there's only one Disctrict. The District of Columbia.
So it's actually fairly complex to define "the United States", because the answer is generally "it depends on the context"
I'm trying to determine whether or not the language in Title 18 refers to "territory" in the sense of "any land that is part of the United States" (which would include the states), or "organised Territories exclusive of states". It's odd that the language is chosen but not clarified.
I'm aware that generally states have jurisdiction within their own boundaries, but that interstate commerce is an exception. Given railroads' history ... the distinction, contenxt, and intent seem needlessly vague.
Your original point remains though it's not clear to me it's the correct interpretation.