Generally, go for the one with the lower student:teacher ratio. My anecdote:
I and a friend both went to low ranked undergrad universities (state schools). Mine, however, had a low student:teacher ratio per class. Comparing notes with him, the main benefit was that professors actually cared about teaching. The number of students wasn't high enough to be a burden. They didn't repeat the same HW and exams every semester. The number of office hours per week per professor was 3-9 hours. They could be that generous because there simply weren't enough students to use up those hours.
We also didn't have TAs teaching any course.
(Also went to a top ranked university for grad school - very few professors cared about teaching).
I also then went to a well-known and ranked R1 university for grad school. I didn't enjoy it very much but also didn't match well with an advisor out of the gate. That colored my experience significantly and in hindsight was really mostly my fault.
Oddly enough, I returned to this school and work a somewhat hybrid staff/research software engineer job and have been here for more than a decade. Go figure.