US insurance giant John Hancock Financial has agreed to invest $227 million in a 201MW portfolio of residential, commercial and industrial solar energy projects owned by SolarCity.