Its not a good idea to compare guns solely on cost to manufacture (and to buy) alone. The Glock's cost to manufacture is a side effect of the simplicity of the design. Its cost is not a side effect of low quality materials or sub-par manufacturing/assembly. However, the M9 is a slightly more complex design that costs slightly more to produce. So, on paper, it could be argued that they are the same value (bang/buck). This is why it would be inaccurate to call these guns "cheap".
However, the Glock has proven to perform better in reliability and torture tests (while performing equally in all other categories). So, that communicates to me that the Glock is a higher value gun than the M9.
Of course, the physical beauty, ergonomics, and trigger aren't the best on the Glock. Those are subjective categories that might sway the decision for the buyer. So, OP, you should handle these guns and shoot them if possible. That will help you make the decision.
Rifle: SCAR 16S, Custom AR-15
Pistols: Colt Python, Springfield 1911 TRP, XD(M) 4.5" .40, Walther PPQ First Edition 9mm, Glock 19