An expected solar energy boom in the United States and the continued quest to achieve grid parity are factors behind a Department of Energy loan agreement that will help a Massachusetts company build two new plants and create hundreds of permanent jobs.