Public universities are not profitable. Quite the opposite: tuition and fees cover only part of their operating costs; the rest comes from the government. In California, AFAIK, public universities don’t have endowments. Government funding of universities is seen as an investment in the state’s economy and in greater opportunity for all Californians. That’s the story at least.
Theoretically they should be self-sustaining on the large scale: education -> greater economic output -> higher tax revenue -> funding for education. Unfortunately that hasn’t really proven to be sustainable in California for a variety of reasons.