Facebook’s investment in mobile-phone advertising appears to have paid off as the social media company last night reported that it accounted for nearly two-fifths of quarterly sales. However, the better-than-expected 39% surge in sales to $4.04 billion came at a price. Facebook said total costs and expenses in the three months to June 30 jumped by 82% to $2.8 billion. Profits fell 9% to $719 million.