I want to do a PhD in theoretical computer science, though I'm still an undergrad. I know I won't be able to pay for a PhD myself--I need full funding if I'm going to do it. I've heard that the stipend you receive varies from program to program, but it seems to me that in general it must be correct that higher ranking CS PhD programs must pay more. My questions is: what is about the cutoff in graduate CS program rankings where you go from fully funded to needing to pay a significant part of the bill yourself? Obviously there are going to be exceptions, but I'm looking for an estimate.
I'll assume that you are remaining in the US for grad study so this answer will be relevant only there (I suppose). Foreign students in US may have need for particular visas, I think.
In general, you will get funding adequate to live and do a degree, provided that you get accepted into the program and are able to work either as a TA or (less common) an RA. The same is true in math, as well.
Universities with doctoral programs also teach a lot of undergraduates in those same fields. There is a need for more teaching than the regular faculty can provide without some assistance. Otherwise there would be no time for them to do their own research.
So, full funding with no work requirements might be pretty rare, nowadays, though it was more common in the past.
But some students get funded under research grants of professors. Those students serve as RAs, but it does require time and effort.
Most, however, are probably TAs who start out grading undergraduates and/or holding small "recitation" sections for large classes. For someone wanting an academic career, this is actually a kind of benefit since it gives you an entry into teaching, which is almost always a requirement for any academic job. If you TA for a few years you get some experience, but you may also be given an entry level class of your own to teach (with some supervision).
While the amount of the cost of tuition might sound high at a good university, TAs and RAs seldom have to pay any of that. The pay is low, but the additional "perk" makes it worth while.
This is also the reason that most students in the US take more than (say) four years after undergraduate to earn a doctorate. They are spending up to about half their time as a TA. Hopefully not half, but maybe close.
But the TA experience is, itself, valuable for a future academic, even for those who can self-fund their degree without it. And, to emphasize, universities need you to be a TA or such, just to make the whole system work.
So, the "ranking" you need to worry about are the same as the rankings for admission to a good program. The funding, while small, will be adequate.