When you are giving a loan to your friend or a business partner, you are not engaging with the general public.
Similar, you can sell shares in your business to your friend or business partner, but if you want to sell to the general public, the SEC is interested.
(I have no clue whether this distinction is the important legal one here.)
Bonds are also registered investments which strict regulations about marketing (IPO), trading, and settlement. In some markets, "private placement" bonds are possible, but there are still many rules to follow created by financial regulators.
A cursory search of "loan vs bond" yields many interesting results. I am sure the variance matters from market to market.