How can something be profitable, but also have negative cash flow?
It's been about thirty years since I took an accounting class, but I think capital expenditures like this AI spending are amortized (deferred?) over several years and don't fully count towards present expenses. So the chunk that counts for this quarter/year can still be small enough to make the company profitable (income > expenses). Free cash flow I would guess is money that came in minus money actually spent, so something like a $1m capital expenditure might count as $100k for this year's expenses but the full $1m for calculating cash flow.