This varies quite considerably by state and locality. The public health system in NYC for instance conducts Covid testing for free for all, without any consideration of immigration status or insurance coverage, and does not even require ID to receive services. There are also public testing sites right outside the two NYC airports.
Originally Posted by
ISTFlyer
Those free tests are only available for US citizens, residents, etc...
A foreigner solely visiting the US would be unable to take those tests.