Newtonian gravity and the Bargmann algebra