Does the university where you get your bachelors/undergrad matter?

Hello everyone! I am getting ready to transfer to a University this Fall from a community college, and I was wondering if medical schools prefer that you have completed your undergrad at a ‘better’ university than one that isn’t as high in the ranks.

If the university is more competitive and prestigious, there’s a chance your GPA won’t be as great as it would be if you went to a less competitive/prestigious school. Therefore, I was wondering whether medical schools take this into consideration. Does a higher GPA at a ‘not so great’ school look better than a slightly lower GPA at a ‘more prestigious’ school? Are they balanced? Does any of this even matter? Thanks in advance!

4.0 from your state school > 3.5 from HYPSM (Harvard, Yale, Princeton, etc. etc.) ceteris paribus. Get your GPA as high as possible in the school you’re at.