First, the debt for those funds could be non-dischargeable, meaning you will still owe it after the bankruptcy. An example of how this could arise, was described in a previous post: Should I Pay My Student Loan with a Credit Card? Debts such as student loans, certain judgments for personal injury resulting from gross negligence and or drunk driving and debts obtained by fraud cannot be discharged under the bankruptcy code. If you borrow from another source, such as a credit card, to pay that loan then the new debt will be non-disagreeableness because the funds were obtained with the intention of filing bankruptcy and furthermore, the new loan can be treated the same as the original debt.
This means that even if the credit card company doesn't object to the discharge, they still might be able to pursue you after the discharge, just like a student loan company could (although best practice for the credit card company would be to object prior to the discharge).
Second, if you used these borrowed funds to pay another debt, those funds might be subject to taking by the bankruptcy court as a preference (a debt paid to the disadvantage of other creditors). If that debt was a non-dischargeable debt, then you may still end up owing that debt after the bankruptcy, and the trustee could use those funds to pay other debts.
Third, and even worse, if the bankruptcy court found that you were attempting to commit a fraud upon the Court by moving this debt, the Court could deny your discharge altogether.
Finally, you could even be subject to criminal liability if the borrowing is determined to be a fraud, meaning you never intended to pay it back. Fraud is a state crime and bankruptcy fraud is a federal crime.