Grants fund research. These usually come from government agencies. If you are good at this, you don't have to teach undergrads because you already bring in $$$, and your grad students are cheap labor. Universities take a cut of grants for overhead. It is a substantial source of funding.