It is of course not true that for any finite morphism $f:X\to Y$ we have $f_*\mathcal{O}_X$ locally free : think about a closed immersion.

In fact, your question is about the important topic of "base change and cohomology of sheaves" for proper morphisms, which is treated by Grothendieck in EGA3. The simplest answer one can give, I think, is that if $f$ is proper [EDIT : and flat, as t3suji points out] and for all $y\in Y$ we have $H^1(X_y,\mathcal{O}_{X_y})=0$ then $f_*\mathcal{O}_X$ is locally free.

You may want to avoid going to find the exact reference in EGA3, since as Mumford says, that result is "unfortunately buried there in a mass of generalizations". In that case, go to chapter 0, section 5 of *Geometric Invariant Theory* (3rd ed.) by Mumford, Fogarty and Kirwan. This is where Mumford's comment is taken from.