Stanford's undergraduate enrollment is 7,087. Very very few if any of those 27 transfers were from JCs. Berkeley's undergraduate enrollment is 30,853. About 4,617 JC transfer students were offered admission.
For California in specific, there are special legal privileges for transfer applications from community colleges to the UC system. That's what you're supposed to do as a community college student, so e.g. it's easier to transfer into a UC from a community college than from a CSU, even though the CSU students are, by design, superior to the community college students.
I'm curious where you get your statistics from? Do they break down the transfer students' details, ie, how many of them are US students and how many are from China? The competition against rich Chinese students for getting accepted into Cal has gotten more and more fierce the past 20 years.