Probabilistic sharing solves the problem of costly punishment