It's very basic though. Americans have to follow laws, including regulations from EPA, OSHA, building codes, routine inspections (e.g. health inspections), and taxes and permits.
External companies don't face as many of these hurdles. Mexico doesn't have to report to the EPA or OSHA, so if implementing better work environments or cleaner air is important, tariffs act as a tax to instead manufacture in America and, in effect, follow those regulations.