I will give my 2 cents. It DOES matter but not may like what people usually think, this is what I mean:
"If both people have identical resumes, word by word, then one will be more favorable than others". But most of the time that case does not happen, everyone has their own background and extracurriculars. So if you think the advantage in the sense that on paper, or screening, yep there would be a minimal advantage to none.
However, there are hidden advantages that people don't talk about. Human loves things that are guaranteed, but since these advantages are not guaranteed even if you major in hard subjects, it's not openly discussed. Majoring in STEM may open many hidden doors:
i) Our academic system is built around scholarly work, which is presentation and publication. That's where the term "publish or perish" comes from. Just some statistics, I think at least 90% of pubs from undergrad are from science majors, if not a lot more.
ii) The opportunities, not just normal but outstanding opportunities, are surrounded science majors, and even more for engineering. Through what? Funding. Million of dollars by private org and government are invested in those programs) (e.g. postbacc program at NIH mostly are science majors, trips going to Africa to build solar cells for villages requires knowledge in engineering, etc). I have seen hundreds of REU email for research/internship opportunity for all science majors publicly advertised but I never see any opportunity for non-science majors. I am sure there are some out there, but they are a lot harder to find, much less instructions, and definitely at a lower impact. Harvard/MIT/UPenn/etc science summer program exceed 3 digits number, but much less for non-science. All come down to funding
iii) Most of the professors that have a high impact on science, you guess, are science professors. Besides research, the name of the professor, assuming your LOR is equally strong, is viewed more favorably, especially if they are well-known. So, you are more likely (not guaranteed) to have a chance to work under those and get a super strong LOR. Moreover, especially when you aim for more premed prestigious awards (Barry Goldwater, Knight Hennesy, Truman, etc, that advantage is even clearer
iv) Connections of those science professors. Medicine is a science major after all, and people know people. They have friends in the med schools that you could potentially apply to. Connections do not mean that when adcom see his/her old friend as your advisor and talk good about you he will accept you, but rather assuming your application is relatively equal to another applicant, which happens more frequently than you may think especially at top med school where everyone is a superstar, he/she may be subconsciously favoring you. Many people know about this but not anyone openly talks about, because publicly admitting this does no good for them. For instance, my main advisor in biochem at UC Berkeley, when I applied for a prestigious biochem internship program at Stanford, his LOR carries a lot of weight. So his LOR may not directly help me get accepted into any med school but it gives me an outstanding EC, which one leads to another and all play an important role in helping me get into med school eventually.
v) Prepare a lot better for MCAT and medical school, even though you don't need to be STEM major to get a high score but you have to admit that a larger percentage of students who achieve higher scores are from these majors.
vi) Your career track is advanced much faster if you decide to stay in academic medicine. All labs in medical schools are science-related, missing 4 years of research experience is a big disadvantage. Could you catch up? You sure could, but you would have to work much harder, but even then if others are also working hard, falling behind in 4 years will make you forever behind. Getting a tenure position is extremely competitive.
vii) This one is a little bit stretched but since I major in biomedical engineering, I can give a small but unique advantage of this major that I occasionally observe. Usually, the "outcome" of bioengineering research are products (e.g. medical devices) with high applications, which make them very easy for fancy marketing. For example, a college team develop a COVID-19 respiratory machine for multiple recipients based on only simple physics and engineering concepts but got on national highlights and won many prestigious awards. Assuming you put the SAME amount of effort into basic science (chemistry, physics, etc), it's almost impossible to achieve the same effect of a breakthrough like bioengineering, the most you would have is a publication. It is more impressive and the story is more fascinating as well. You tell me which EC is more interesting to you if you are a adcom:
- I conduct research in CRISPR Cas9 in genome editing on mice and we make a breakthrough to show the advent of facile genome engineering using the bacterial RNA-guided CRISPR-Cas9 system in animals and plants is transforming biology
- I develop a biosensor to measure physiological signals in the lab, then apply for IRB approval at my university so I can use that technology and test on 300 patients in Uganda, it's an international collaboration between 2 countries and we are currently applying for our patent. Then we utilize machine learning with the hope to detect multiple hidden respiratory diseases at once using a low-cost device implemented in sub-Saharan countries to increase accessibility to care.
As you can see, for the first case, every field of science is very specific, if you don't do research in that field it's hard to understand what it even means, even if that bench lab person spend triple the amount of time to do Western plot and clean petri dishes (the first example is published in Science and get cited 4000 times). While the first case requires dozen of PhD to accomplish, the second bioengineering example all it takes are a couple of undergrads + a sprinkle of initiatives.
First, none of the things above is absolute, there are always outliers who study history will get 528 mcat and 5 publications. Second, I want to emphasize that majoring in science/engineering MAY, not guaranteed, increase your likelihood of success and stand out, with the cost of a harder major which makes you spend more time studying, it's like a two-edged sword. (e.g. like you major in STEM but that doesn't mean you will guarantee to get a publication, or having a chance to participate in a cool STEM project. Third, these reasons may seem far unrelated to med school admission, but these small things are the changing game factors to distinguish you from thousands of applicants that sound the same