You are referring to the Jones Act passed in 1920.
It requires that ships that move cargo between two American ports-say load cargo in Houston and unload that cargo in NYC must be built in the USA, registered as an US Flag ship and carry a crew composed primarily of US citizens.
A foreign flag ship can load cargo in say Singapore and deliver some of it to San Francisco and the rest of it to Los Angles. What it is NOT permitted to do is load cargo in San Francisco and unload it in any US port, in this example Los Angles.
Actually, I was conflating two separate but related items of legislation: the 1920 Jones Act, and the Passenger Vessel Services Act of 1886. The latter says that
"no foreign vessels may transport passengers between ports or places in the United States, either directly or by way of a foreign port, under a penalty of $200 for each passenger so transported and landed. As a result, all vessels that have engaged in the coastwise trade have been required to be coastwise-qualified (i.e., U.S.-built, owned, and documented)." (-Wikipedia)Can't speak to the difference between being "U.S.-built, owned, and documented" and "U.S.-flagged."
Regards,