Free: Contests & Raffles.
Apex triggers make the M & P pretty unbeatable! Just ask Chris Costa...
I would go with a Glock 17/19/34. The 34 is my favorite for having fun/competition, the 17 is great for packing in the woods. Mags (you should have at least 10 or more) are dirt cheap, and last forever. I recently found them online for $22 new (Glock OEM). XD mags are harder to find and are twice as expensive, same with M&P mags only M&P mags are more expensive. I also found 33 round mags a couple months ago, again OEM mags, for under $30, buy at least ten of those too. Glock triggers are o.k. out of the box, especially the 34, but they can be made much better using stock parts and a little knowledge. XD and M&P triggers are absolutely horrendous.Word for word what I would say. I would add that having shot a few Glock 9mm under water and other sundry torture tests, they are without peer.
Glock 19 gen 3. No other research needed
To the OP, the best thing to make a decision is go to a range with rentals, or shoot with some friends and try as many different models that you can and see what fits for you. Too many opinions can be confusing. Find what works and feels best to you!