Trademark law functions as a type of unfair competition law and protects businesses against competitors stealing customers or harming the goodwill of the business by creating confusion.
Trademark law covers a business's brand, slogan, logo and packaging and it may be enforced federally (under the Lanham Act) or on a state-by-state basis under existing state laws. If a business is likely to loose customers or looses customers as a result of confusion between competitors, then the business may be able to bring a trademark infringement action under the Lanham Act.
In general, the first user (referred to as the senior user) has superior trademark rights over the later user (referred to as a junior user). If necessary, the senior user can file a trademark lawsuit to stop the junior user from causing confusion. This confusion can be as to source, affiliation, sponsorship and endorsement between the competing companies and it can occur before the sale, at the time of the sale or after the sale has occurred.