Imagine you have an equity trading at a spread of 50 vs 51.
You have a solid idea the correct price of the equity is the exact midpoint of 50.5, as well as the ability to move very quickly when you see a new order come in.
As you are very confident in the correct price of this asset, when you see an order come in at say, 51, you're more than happy to quickly better the market maker's public price with a better than NBBO price of, say 50.99 as you're still selling an asset you know is worth 50.5 for 50.99, a lower mark up than what the spread would have given sure, but still a healthy profit and a price improvement for the person trying to buy at 51.
As long as you know the order is less well informed than you (eg from retail customers etc) you can repeat this all day long for huge profits, and people will pay institutions like retail brokers large sums for knowing that the person making the trade is likely poorly informed and can thus be served these improved (but still bad relative to 'true' value) prices.
As it is a highly competitive market place you can't just sit back and try and keep the spread wide as outsiders with fast models just keep jumping in front of you constantly, so you quickly enter a world with frequent, small price improvements from the fastest teams to this type of order traffic.