His decision to forgo a salary in favor of a backend share turned the modest comedy into his career’s most profitable film.