VTI and VT, two of the largest index funds, DO invest in unprofitable companies.
And for the rest (SP 500 etc), these companies are going to fake profits using some sort of financial engineering to be included.