This line of thinking is often repeated in election cycles and mindless online discussions, with mantras like "We justify doing something heinous because it serves 'American Interests'" or "We'll coercively tax one group and redistribute funds to another because they'll do something dubiously for the 'greater good'".
However, Utilitarianism is not a foundational principle of libertarian ideology. In fact, libertarianism often refutes and rejects it as applied to governments. It doesn't prioritize egalitarianism or rely on public opinion when defining citizens' rights.
The argument for a free market unencumbered by protectionist policies isn't about the greater good; rather, it's an argument for an ethical government grounded in first principles.
The "greater good" argument tends to crumble under close examination and logical scrutiny. Its claims on reason collapse as soon as you scrutinize them more deeply.
Notably, Utilitarianism has been the basis for nearly all modern-day dictatorships, which rely on a monopoly of violence to enforce the "greater good".
It's possible to support free markets while still caring for others – this is called altruism. It's similar to utilitarianism but without coercion and fallacies.