The question is a little confusing because it appears to conflate several issues. First, a loan to the company must be properly documented. Such transactions are almost always unsecured, leaving it almost impossible to recover in case of bankruptcy. Second, if the owner is intentionally underpaying himself or herself, they may run into trouble with the IRS or FTB. This scenario is very fact-dependent, and more information would be needed to assess possible liability to the taxing authorities. Third, paying the owner back right before bankruptcy may trigger an adverse action by the other creditors (i.e., the transfer prior to bankruptcy could be considered illegal and fraudulent). A business owner should check with a CPA about tax liability and documenting the loans, and consult an attorney in order to address any potentially improper transfers before this case becomes actionable.