Medical research depends heavily on faculty and postgraduate folks.
Only some of their thousands of annual graduates are undergrads - about 1/3 of them, per Wiki.
Include postgraduate folks and they're still doing a lot more than just teaching and credentialing. Places like Harvard output research, too.