Meta’s heavy AI spending is boosting ad revenue — and the company is only getting more profitable in the process.