SolarCity Corp. (SCTY), the second-largest U.S. solar company by market value, posted a first-quarter loss as it bore higher costs from installing rooftop solar systems at little or no charge to customers.