There is masses of half-assed, broken, wretched and downright brain-damaged open source code out there, and anyone who claims otherwise doesn't know what they're talking about. Much of it is written as a quick and dirty hack to solve an individual's problem and then released, with scant regard to long term maintainability. Yes, there are some gems, but they are hidden amongst many many times more garbage. The good thing is you can fix it, if needed, and the software will evolve. But typically commercial software has gone through that process several times before it gets to market, because despite what people here may say about microsoft, not many people will pay good money for completely broken crap that doesn't work.
Many companies have paid ridiculous amounts of money for code that doesn't work, particularly custom and semi-custom code. The NHS in the UK scrapped a >10 billion GBP - that's 16 billion USD - national healthcare system. Vertical integrators that have a stranglehold on certain professions are often full of horrible, horrible code. Insane amounts of spaghetti code have been made by cheap outsourcing companies to go into "commercial software". Closed source has its gems. Open source has its gems. But as a broad generalization it's the pot calling the kettle black, both have a huge spread. Often it's just good vs better or bad vs less mediocre and the question to pay or not depends on whether a $50k+ worker could be 1% more effective - that's $500 - with that tool or not.
Personally I find there's a difference of layers, closed source software doesn't sell unless it looks good on the surface with user interface and hand-holding documentation, comes with buzzword compliance, feature checklists and fancy demos of the capabilities. Open source is more grab it, put it through its paces and see if it works for you. Doesn't have to be so pretty to look at, but be a solid workhorse with detailed technical documentation but often a high learning curve. It's usually more about manpower though than anything else, often you realize there's five open source developers trying to compete with a hundred closed source developers and it's not so much a better of the quality of the coders but simply about being outgunned.