That's how market makers make money. They match up investors who want to buy and sell the amount they want to sell at the time they want to sell it.
Contrast to the private corporation that I own shares in, where it's taken me weeks to broker a deal to buy some more shares from another shareholder -- including face to face meetings with many of the officers of the company. We had to have an accountant do the valuation and I ended up buying exactly the number of shares the other owner wanted to sell because this would mean more financing complexity and paperwork for the hardworking officers who should be spending their time building the business.
Maybe your broker gets $10 and the market maker gets $15 but this is a bargain when you consider how much it would cost without them. Imagine trading on the New York Stock exchange when you were in San Francisco in 1860!
Many low latency (high frequency) traders are market makers. Since the first successful offer gets the trade, you've got to be the fastest to survive at this game.
One reason it's hard to make money as a trader is that as people find discover deviations from ideality and exploit them, the deviations go away. "Market neutral" strategies we quite successful through the 90's but are no longer profitable. Today I'm worried about the options market because trading in volatility may alter the relationship between implied and realized volatility and ruin another family of simple strategies that have performed well lately.