Does your previous university’s reputation matter when applying for a PhD? I have been applying to PhD programs for the past 2+ years and keep getting rejected. I have pretty good degrees that I worked hard for from good universities (not the top unis). 

For the past year I’ve been doing everything I could think of to improve my CV; working for free as a research assistant at a research institute, publishing, attending seminars and conferences, etc.

I always thought that all applicants were treated equally and were judged only by their grades, personal statement and CV. However, I just got my 15th rejection letter, and the university was “kind” enough to tell me that I was rejected because I didn’t meet their entry requirements, specifically, that the universities where I did my Bsc and MSc don’t have a good enough reputation for my application to be considered.

I have been told by academics in the past that potential PhD candidates aren’t judged using this criterion. So my question is, are Phd applications one of those things where people are told that everyone has an equal opportunity while the reality is wildly different? Because I would like to know if I’m wasting my time applying and putting myself through all this stress unnecessarily.
I always thought that all applicants were treated equally and were judged only by their grades, personal statement and CV.


Applicants from different universities are not treated equally (at least not by my department's selection committee). 

Your grades are looked at as a baseline (to filter out obvious rejections or single out interesting cases), and then a discussion goes on about the rest of it (CV, statements, references and research experience). You are missing two key parts (which you refer to in your comments but not in the question body): reference letters, and publication record. You say that you have read your reference letters: have you read all of them? It could be that you are experiencing selection bias - the referees who are comfortable with you reading their letters are ones who generally like you. In addition, nowadays top schools (in computer science at least) may reject your application if you haven't had at least one decent publication.


  I have been told by academics in the past that potential PhD candidates aren’t judged using this criterion.


This must have been a misunderstanding. 

The institution the conferred your degree absolutely matters. There is a huge difference between how a top 5% student from a top university and one who hails from a less renowned university is perceived. 

This cuts both ways - good universities may produce inadequate graduates, and less reputable ones can produce excellent students. The institution is just a signal of your likelihood to succeed in your PhD.