Loans get issued based on profit generation (or asset value), so no, it is not “to keep them afloat”. You can’t get a loan if your company is not doing well or too risky (that’s why startups raise equity - because they are still too risky for someone to lend them money).
A loan is a form of debt, which is one of the two main forms of capital - the other main one being equity. Debt is less expensive than equity, so companies prefer to issue to raise capital via debt than equity.
Its not just profit that is considered for a loan. Anything related to states is more stable and thus less risky. Or how would you evaluate state bonds by profit only? Elon knows what i am talking about.
A loan is a form of debt, which is one of the two main forms of capital - the other main one being equity. Debt is less expensive than equity, so companies prefer to issue to raise capital via debt than equity.