In my experience (lawyer in Palo Alto for 7 years), parties can agree by contract to do or not do many many things. Even provisions that limit legal recourse, like the much-decried mandatory arbitration clauses [1] have held up all the way to the US Supreme Court. I would be very interested to know what legal basis there would be to invalidate a license agreement that says: you can have access to this content but only if you promise not to tell other people about it.
1: http://www.nytimes.com/2015/11/01/business/dealbook/arbitrat...
And "there are no limits to the content of contracts people freely enter" is obviously an untenable position – we'd all agree that a provision giving me your kidneys, hidden somewhere deep in the ToS is unenforceable.