loanDepot posted a smaller loss in the second quarter compared to the first, leaning into home equity lending.