If it's not illegal, it should be. Investments typically involve disclosure for good reason.
(For legal and tax reasons I'm guessing the "infinite" valuation would instead need to merely be astronomically high; the point remains however that in an economic sense they would be buying information rights rather than shares.)
Somewhat incidentally, I think this is one of the reasons why YC is such a powerful force. YC recently invested in their 1000th startup -- couple that with the many other thousands of applications they've gotten (when you submit an application to YC, you're spilling a lot of beans already about yourself / your startup to YC), all of that put together is quite the house of knowledge. And on top of it all, it owns HN and thus to some extent has the power to frame the prevailing narrative of tech, I think there is no other entity in the world more in tune with the spirit and direction of startups than YC.
On the other hand, YC Fellowships might be pretty much the "infinite valuation investment" idea I mentioned -- while there's no formal information rights attached, I'm sure they're getting a strong signal for which companies they'll want to fund.
If professors want to teach, they should teach. If they want to invest, they should invest. But they shouldn't be doing both without making it clear to students what they've actually signed up for.
Actually, all of it is deceptive (to entrepreneurs, to students, to the public, to other investors) and depressing. But that part is particularly disturbing.