Free riders are a solved problem. The state I attended college in, Florida, has a tuition assistance program called "Bright Futures". It pays 50%/75%/100% of your tuition based on your HS and college grades regardless of need. However, if you flunk out of even one class, you have to pay them back the money you got for that class. I don't know the exact rules if you don't graduate but you could also make people pay the money back if they fail to graduate.
Ultimately, though, all we're talking about here is tuition. Not a full "free ride". Someone who goes to college just to party still has to pay room and board, food costs, school fees, etc.