I don't know about math, but in CS, a lot of funding comes from specific grants, so you'll be working on something related to what your advisor got grant funding for.
Regardless of grants, etc., your general area of work is going to be based on what the faculty members' focuses are. But in any case, you'll probably still be doing your own sub-piece of some larger effort. You wouldn't choose an advisor at random, so this isn't really relevant.
I mean, if you're interested in astrophysics, you shouldn't go to a school where the Physics department is focused on nuclear physics!