In equities, front-running means a broker trading ahead of a client's order and it is illegal. On a public chain, pending transactions are visible to everyone by design, so the same behaviour is an open race decided by fees and block-building relationships rather than by privileged access.
It affects more than swaps. NFT mints, arbitrage, liquidations and even bug fixes get front-run: a white-hat patch broadcast publicly can be copied and used as the exploit before it lands, which is why serious disclosure happens privately.
The legal position is unsettled and varies by jurisdiction. A US prosecution in 2023 treated a particular block-manipulation scheme as fraud, so "the code allowed it" is not a reliable defence. Assume anything you broadcast publicly can be raced, and use private-mempool submission when the order matters.
Related: mev, mempool, sandwich-attack, private-mempool