In this case the film itself isn't non-profit, the organization collecting the money is. They collect it as a non-profit and distribute the money to projects which don't have to be non-profit, so whatever you earn later is still yours to keep.
Even if the film was somehow done as a non-profit you could probably still keep most of the profits - you just need to structure it so that the profit goes towards salaries for everyone involved, becoming a business expense rather than a profit. Set up the salaries as deferred, then pay them as the money comes in - maybe if the film really blew up you'd have profits you couldn't keep (once the deferred payments were all met) but the likelihood of that happening isn't very high. In any case I don't see much reason to structure a film project as non-profit in the first place unless your primary goal is to use the film to raise money for a cause. Better to just try and find a fiscal sponsor in most cases.