People who say the opposite are thinking of developers, often themselves, who were able to become skilled without a CS degree. That is indeed quite possible, and I've met many individuals in this category. I'm not going to say the best developers I've met had no degree, but I've met great developers without a degree. But I wouldn't say it is common; most developers without a CS/STEM degree whom I've met were, indeed, mediocre engineers that often had no business being there.
I've also met many poor developers from great schools and great developers from schools with poor reputation. But, as a thought experiment, if I was to pick a developer based solely on whether they have a degree and where they got this degree, lacking any other piece of information, I'd always pick the ones with a degree from a reputable school.