Hanesbrands recorded a better than expected first-quarter net loss as the basic apparel brand increased prices to offset rising cotton costs.