Every runner should have to pay a one-time flat-fee to get in. Say $100. As one poster noted you HAVE to get money upfront to pay for the crazy high expenses it costs to put on a race. Give $1 back for each minute under 3-hours. Pay $1 for every minute over 3-hours with a cap at $300 total. No one will pay over that. DNF simply owes the full $300.
What about doing this with a shorter race? Like a 5k? $25 to run it. $1 for every minute under 25 minutes. Pay $1 for every minute over 25 minutes. Cap it at $50.