There are a number of ways to combat this.
- Have a theme, a dataset, or some other component that is not announced until the day it starts (and to be eligible an entry must demonstrate meaningful incorporation of that component).
- Have a manageable organizer-to-participant ratio so they can do a decent job of verifying that teams aren't using a developed concept.
- Don't allow premade teams, have individuals pitch concepts and form teams.
Each of those can be gamed to some degree, but they can go a long way, and to game them requires serious intent to deceive.
They didn't even try, at all. The winner was openly a fully formed startup that demoed their app at a Salesforce meetup weeks before the hackathon. That's just, mind-blowing.