
174 B.R. 351 (1994)
In re INDIAN MOTOCYCLE ASSOCIATES III LIMITED PARTNERSHIP, and Indian Motocycle Associates Limited Partnership.
MASSACHUSETTS HOUSING FINANCE AGENCY, Appellant,
v.
INDIAN MOTOCYCLE ASSOCIATES III LIMITED PARTNERSHIP, Appellee.
Civ. A. No. 94-30038-FHF.
United States District Court, D. Massachusetts.
October 31, 1994.
*352 Mark D. Cress, Bulkley, Richardson & Gelinas, Springfield, MA, for Massachusetts Housing Finance Agency.
Paul R. Salvage, Bacon & Wilson, P.C., Springfield, MA, for Indian Motocycle Associates III Ltd. Partnership and Indian Motocycle Associates Ltd. Partnership.

MEMORANDUM AND ORDER
FREEDMAN, Senior District Judge.

I. INTRODUCTION
Before the Court is a bankruptcy appeal brought by the Massachusetts Housing Finance Agency ("the MHFA") against Indian Motocycle Associates Limited Partnership and Indian Motocycle Associates III Limited Partnership (respectively, "Indian" and "the Debtor"). The MHFA seeks reversal of the Bankruptcy Court's refusal to compel the Debtor to restore certain funds that it allegedly diverted from the operating account of a low-income multifamily housing project.

II. FACTUAL AND PROCEDURAL HISTORY
On October 30, 1987, Indian obtained a mortgage loan for $8.6 million from the MHFA to convert a former industrial building in Springfield, Massachusetts, into a low-income multifamily residential housing project ("the Project"). Appellant's Brief ("MHFA's Brief") at 2. Under the provisions of the National Housing Act ("the Act"), the United States Department of Housing and Urban Development ("HUD") coinsured the loan. Id. In addition to a promissory note and a mortgage, Indian executed a "Regulatory Agreement" which required Indian to comply with all applicable federal regulations relating to the coinsurance provided by HUD. Id. The mortgage and Regulatory Agreement were subsequently recorded. Id. at 5.
In 1989, the Debtor acquired the Project from Indian, and the Debtor assumed all of Indian's financial obligations under the note, mortgage and Regulatory Agreement. Id. at 5. On August 4, 1992, the MHFA notified the Debtor of the latter's default on its obligations under the note, mortgage and Regulatory Agreement. Id. After being notified of its default on its financial obligations, the Debtor withdrew Project funds from the operating account of the Project. Id. at 5-6. Specifically, the Debtor withdrew and paid the following:


$ 5,000.00     to New York counsel to pursue the
                 Debtor's claim in an unrelated
                 bankruptcy case.
$20,000.00     to Coopers & Lybrand.
$35,000.00     to Bacon & Wilson (bankruptcy retainer).
$ 5,000.00     to Rubin Enterprises, an entity
                 owned by the principal of the
                 managing general partner of the
                 Debtor.

Id. at 6.
On December 15, 1992, after it made the above disbursements, the Debtor filed a *353 Chapter 11 petition. Brief of Appellee ("Debtor's Brief") at 2. In addition to its obligations to the MHFA, the Debtor owed well over $9 million to unsecured creditors, and over $2.2 million to secured creditors. Id. On December 31, 1992, the MHFA filed a motion to compel the Debtor to restore the above disbursements to the Project. MHFA's Brief at 3. On January 6, 1994, the Bankruptcy Court found that the disbursements were, in fact, disbursements of Project funds. In re Indian Motocycle Associates III Limited Partnership and Indian Motocycle Associates Limited Partnership, 161 B.R. 865, 867 (Bankr.D.Mass.1994) ("Bankruptcy Opinion"). The Bankruptcy Court also found that the disbursements were not authorized by the terms of the Regulatory Agreement. Id. at 867. Despite such findings, the Bankruptcy Court denied the MHFA's motion to compel the Debtor to restore the diverted funds. In re Indian Motocycle Associates III Limited Partnership and Indian Motocycle Associates Limited Partnership, 161 B.R. 865 (Bankr. D.Mass.1994) ("Bankruptcy Order").
The MHFA contends that the Bankruptcy Court erred as a matter of law in failing to enforce the terms of the Regulatory Agreement and in refusing to order the Debtor to restore the diverted Project funds. Therefore, the MHFA urges this Court to reverse the Bankruptcy Court order and mandate entry of an order compelling the Debtor to restore the diverted funds. Alternatively, the Debtor argues that the Bankruptcy Court was correct in refusing to order restoration of the diverted funds. As support for its position, the Debtor points out that the MHFA has other remedies by which the terms of the mortgage and Regulatory Agreement could be enforced against the Debtor.

III. STANDARD OF REVIEW
In reviewing the bankruptcy proceedings, the Court applies a de novo standard with respect to legal determinations, and a "clearly erroneous" standard as to findings of fact. In re DN Assocs., 3 F.3d 512, 515 (1st Cir.1993).

IV. DISCUSSION
The Debtor does not dispute the Bankruptcy Court's finding that the disbursements were Project funds. See Bankruptcy Opinion at 867. Nor does the Debtor challenge the Bankruptcy Court's determination that the disbursements were not authorized by the Regulatory Agreement. Id. at 867. Thus, the only issue before the Court is whether the Bankruptcy Court should have compelled the Debtor to restore the diverted funds. See Bankruptcy Order. The Court now turns to a discussion of this issue.
A. The MHFA's Argument Regarding the Mortgage and the Regulatory Agreement
At the threshold, the Court lays out the framework that guided the financial relationship between the Debtor and the MHFA. The Debtor assumed an $8.6 million mortgage loan from the MHFA. Because the loan was coinsured by HUD, the National Housing Act's regulations applied. Under the Act, the Secretary may require the mortgagor to be regulated or restricted as to rent, sales, operation methods, and the like. See 12 U.S.C. § 1715k(d)(2)(A); see also MHFA's brief at 10.
The mortgage was consistent with the National Housing Act. Specifically, the mortgage required that the Debtor assign to the MHFA its rights to all leases, rents, profits and income from the Project:

Assignment of Leases and Rents  That all leases, rents, profits and income from the property covered by this Mortgage are hereby assigned to the Mortgagee [MHFA] for the purpose of discharging the debt hereby secured.
See MHFA's Brief at 13, quoting Mortgage; see also 12 U.S.C. § 1715k(d)(2)(A). Nonetheless, so long as the Debtor did not default, the MHFA gave it permission to collect the rents, profits and income for use consistent with the Regulatory Agreement:
Permission is hereby given to the Mortgagor [Debtor] so long as no default exists hereunder, to collect such rents, profits and income for use in accordance with the *354 provisions of the Regulatory Agreement. . . .
See MHFA's Brief at 13, quoting Mortgage. However, the Debtor did default on the mortgage loan. MHFA's Brief at 5. Thus, the MHFA asserts, the permission given to the Debtor  under the mortgage  to collect rents, profits and income was revoked. See id. at 13-15.
In addition to defaulting, the Debtor disregarded the terms of the mortgage by distributing Project funds in violation of the Regulatory Agreement. See id. As a result, the MHFA argues that the Regulatory Agreement enables it to seek injunctive relief against the Debtor. Id. at 17. Specifically, the MHFA believes that it is entitled to recover the unauthorized distributions. Id. The MHFA points to the Regulatory Agreement for support of its position:
[I]f the Owner [Debtor] violates any provisions of this Agreement, the Mortgagee [MHFA] or Secretary [of HUD] . . . may initiate any of the following actions. . . .
d. Apply to any court, State or Federal, for specific performance of this Agreement, for an injunction against any violations of this Agreement, for the appointment of a Receiver to take over and operate the Project in accordance with the terms of the Agreement, or for such other relief as may be appropriate, given the nature of the default and the damage resulting from the default.
Regulatory Agreement at 17, ¶ C(1)(d). The Regulatory Agreement further provides that:
The damage to the Project as a result of Owner's [Debtor's] breach of its duties and obligations under this Agreement will include, but not [be] limited to, the amounts specified below. Any damages collected or recovered by the Mortgagee [MHFA] or the Secretary [of HUD] will be payable to the Project account. . . .
a. In the case of unauthorized distributions of Project funds or Project assets, the damages will be the amount of the unauthorized distributions plus interest from the date the distribution was made.
Id. at 17-18, ¶ C(2)(a). The MHFA argues that because the Debtor's actions clearly violated the terms of the mortgage and the Regulatory Agreement, the Bankruptcy Court should have enforced those terms as a remedy. MHFA's Brief at 7, 17.
B. The Bankruptcy Court's Decision
Instead of enforcing the terms of the mortgage and the Regulatory Agreement as the MHFA would have preferred, the Bankruptcy Court concluded that "[b]reach of the Regulatory Agreement is immaterial with respect to the MHFA's rights against the Debtor." Bankruptcy Opinion at 867. As support for its conclusion, the Bankruptcy Court reasoned that the Regulatory Agreement was "merely designed to protect the note obligation." Id. The Debtor's breach of the Regulatory Agreement, the Bankruptcy Court continued, was analogous to a debtor converting collateral since the disbursements  taken from the rents due under the Project  were the MHFA's collateral. Id. at 867-68. With or without conversion of the collateral, the Bankruptcy Court deduced, the MHFA's claim against the Debtor remained the same  the amount on the defaulted mortgage loan. Id. The Court turns to a consideration of the propriety of the Bankruptcy Court's decision, in light of the arguments proffered by the MHFA.
C. Classifying the Disbursements
To reiterate, it is undisputed that the disbursements were Project funds. It is also undisputed that the disbursements were not authorized by the Regulatory Agreement. Thus, the Court moves to consider what type of interest the MHFA had in the disbursements.
1. Federal or State Law
As a prerequisite to determining what type of interest the MHFA had in the disbursements, the Court must first determine whether federal or state law controls the parties' rights in relation to the disbursements. The Supreme Court has held that state law controls the determination of the extent of a security interest in property, such as rents, unless a federal interest requires otherwise. See Butner v. United States, 440 U.S. 48, 55, 99 S.Ct. 914, 918, 59 L.Ed.2d 136 *355 (1979). Because of Butner, and because the MHFA is a Massachusetts agency and the Debtor is a Massachusetts limited partnership, the Debtor claims that Massachusetts law should apply. Debtor's Brief at 10; see also Prudential Ins. Co. of Am. v. Boston Harbor Marina Co., 159 B.R. 616, 619 (D.Mass.1993). On the other hand, the MHFA states that Butner's exception applies  a federal interest does require otherwise, so that state law does not control the determination of the extent of a security interest in property. See MHFA's Reply Brief at 5; see also Butner, 440 U.S. at 55, 99 S.Ct. at 918. Specifically, the MHFA asserts that the federal interest at issue is that of the National Housing Act since the loan in question was made under the Act's provisions, and it is coinsured by the United States, through HUD. See MHFA's Reply Brief at 5.
The Court notes that federal law governs the rights of the United States arising under nationwide federal programs. See United States v. Kimbell Foods, Inc., 440 U.S. 715, 726, 99 S.Ct. 1448, 1457, 59 L.Ed.2d 711 (1979). Thus, "when federal agencies lend funds by the authority of federal legislation, their rights as lenders also derive from and warrant the protection of federal law." United States v. Landmark Park & Assocs., 795 F.2d 683 (8th Cir.1986), quoting Kimbell Foods, Inc., 440 U.S. at 726-27, 99 S.Ct. at 1457. Because HUD in the case at bar did not lend funds, but rather coinsured a mortgage, the Debtor urges that there is no sufficient federal interest warranting an application of federal law. See Debtor's Brief at 19-21. The Debtor points out that where cases have held that federal law applies pursuant to the Butner exception, the mortgagee was a federal agency or arm of the federal government. Debtor's Brief at 19. For example, in Landmark Park & Assocs., 795 F.2d at 684, and in In re Westwood Plaza Apartments, Ltd., 154 B.R. 916, 918 (Bankr. E.D.Tex.1993), HUD held a mortgage directly. In the case at bar, however, HUD only coinsured the loan, while the MHFA held the mortgage directly. See Debtor's Brief at 19. Because HUD was only a coinsurer and the MHFA was the mortgagee, the Debtor contends that the Butner exception does not apply and state law controls. Debtor's Brief at 21.
Upon review, the Court disagrees with the Debtor's argument. The Debtor is correct in asserting that the cases applying the Butner exception had a federal agency as the mortgagee. See Landmark Park & Assocs., 795 F.2d at 684; In re Westwood Plaza Apartments, Ltd., 154 B.R. at 918. However, the Debtor points to no case  nor does the Court find any  where the court held that the Butner exception applied only when the federal agency was a mortgagee. Rather, the Court believes that the policy underlying the National Housing Act applies equally well where the federal agency was the mortgagee as well as the coinsurer. That is,
the application of federal law to the rights and remedies of the United States upon default of federally held or insured loans is warranted by the `overriding federal interest in protecting the funds of the United States and in securing federal investments'. . . . Protection of the federal treasury and the purposes and integrity of nationwide federal lending programs is thus a `federal interest' of the kind referred to in Butner which requires a different result from the general rule of resort to state law.
Landmark Park & Assocs., 795 F.2d at 686, quoting United States v. Victory Highway Village, Inc., 662 F.2d 488, 497 (8th Cir.1981) (emphasis added).
Furthermore, the Court notes that the National Housing Act authorizes HUD to grant mortgages and to coinsure mortgages. 12 U.S.C. § 1701 et seq.; 12 U.S.C. § 1709. Because HUD's power to grant mortgages as well as to coinsure mortgages arises from the same authority, the policy considerations underlying both aspects of HUD's power are the same. That is, the National Housing Act encourages the creation of decent and affordable housing for individuals who would otherwise suffer with inadequate housing. See 12 U.S.C. § 1715k(a); see also United States v. Winthrop Towers, 628 F.2d 1028, 1036 (7th Cir.1980). The Court believes that this goal is not only furthered when HUD grants mortgages, but also when HUD coinsures *356 mortgages. Thus, even though HUD was not the mortgagee in the case at bar, the Court concludes that HUD's coinsuring the mortgage is a sufficient federal interest warranting the protections of federal law. See Butner, 440 U.S. at 55, 99 S.Ct. at 918; Landmark Park & Assocs., 795 F.2d at 683.
Continuing, the Court finds that the cases cited by the Debtor miss the mark. Debtor's Brief at 7-11; see also Prudential Ins. Co., 159 B.R. at 616; In re GOCO Realty Fund I, 151 B.R. 241 (Bankr.N.D.Cal.1993); In re Rancourt, 123 B.R. 143 (Bankr.D.N.H.1991); In re Prichard Plaza Assocs. Ltd. Partnership, 84 B.R. 289 (Bankr.D.Mass.1988). The Debtor points to these cases because state law determined the rights of the parties to the mortgage and security interest. Furthermore, these cases had state agencies as mortgagees, like the MHFA in the case at bar. Unlike the case at bar, however, the Court observes that these cases did not have HUD as a coinsurer. Thus, the courts in the cases cited by the Debtor did not consider whether state or federal law applied when HUD was the coinsurer of a loan.
At bottom, the Court concludes that federal law controls the parties' rights regarding the transferred disbursements.
2. Did the MHFA Perfect Its Interest in the Funds?
Under federal law, unless the security agreement provides otherwise, a creditor's security interest in property is perfected upon the debtor's default. See Landmark Park & Assocs., 795 F.2d at 687; In re Executive House Assocs., 99 B.R. 266, 277 (Bankr.E.D.Pa.1989). The Court does not find, nor does the Debtor assert, any prerequisites to perfection of the security interest.[1] Thus, the Court believes that the MHFA's security interest in the Project funds was perfected upon the Debtor's default. See Landmark Park & Assocs., 795 F.2d at 687; In re Executive House Assocs., 99 B.R. at 277. Therefore, the MHFA had a perfected interest in the Project funds when the Debtor disbursed them.
Succinctly put, the Court finds that HUD's coinsuring the mortgage is a sufficient federal interest warranting the protections of federal law. See Butner, 440 U.S. at 55, 99 S.Ct. at 918. As a result, the Court resolves that the MHFA did not need to possess the property or have a receiver appointed to activate its interest in the Project funds. See Debtor's Brief at 11. Rather, the Court concludes that the MHFA's interest in the Project funds was activated upon the Debtor's default. In re Executive House Assocs., 99 B.R. at 277, citing Landmark Park & Assocs., 795 F.2d at 687. Thus, since the Debtor transferred the disbursements after it had defaulted on the loan, and since the disbursements were Project funds, the Court finds that the MHFA's interest in the funds was superior to that of the transferees.
D. Ramifications of the MHFA's Perfected Interest
Having determined that the MHFA had a perfected, choate interest in the disbursements when the Debtor transferred them, the Court moves to a consideration of the MHFA's rights. The Bankruptcy Court, although never expressly discussing the extent of the MHFA's interest in the disbursements, viewed the Debtor's transfer of funds as incidental since the amount of the MHFA's claim against the Debtor remains the same. Bankruptcy Opinion at 867. The Court respectfully disagrees with the Bankruptcy Court's decision.
Initially, the Court believes that the Bankruptcy Court erred in concluding that the Regulatory Agreement simply protects the note obligation. Bankruptcy Opinion at 867. Rather, the Court sees the Regulatory Agreement in two veins. First, the Court views the Regulatory Agreement, as well as the mortgage and the note, as evidence that HUD was an intentional party to the mortgage arrangement. See Regulatory Agreement at 3; see also MHFA's Brief at 12-13. That is, since the Regulatory Agreement paralleled the provisions of the National Housing Act, the MHFA and the Debtor expressly intended that HUD coinsure the mortgage. *357 See MHFA's Brief at 14, citing 24 C.F.R. 251.505, 251.704(b).
Secondly, and more importantly, the Court believes the provisions of the Regulatory Agreement should be honored. Since the parties availed themselves of the security of HUD's coinsurance, the parties should be forced to stand by their agreement. See Winthrop Towers, 628 F.2d at 1036 (developers who take advantage of HUD coinsured loan programs are presumably sophisticated enough to make agreements they will be able to live with). In response to the Court's position, the Debtor asserts that the Bankruptcy Code expressly grants a debtor the authority to reject burdensome contracts, despite pre-petition contractual obligations. See Debtor's Brief at 17, citing 11 U.S.C. § 365. While the Debtor's assertion may be true, the Court reiterates that the Debtor did not violate the terms of the Regulatory Agreement and mortgage while invoking the protections of 11 U.S.C. § 365. Rather, the Debtor transferred the disbursements before it filed for bankruptcy and, accordingly, before it sought the protections of the Bankruptcy Code. Thus, the Court finds the Debtor's argument unpersuasive.
Furthermore, the Court disagrees with the Bankruptcy Court's statement that with or without conversion of the collateral, the MHFA's claim against the Debtor would be the same. Bankruptcy Opinion at 867-68. Section 506(a) of the Bankruptcy Code provides, in pertinent part, that:
An allowed claim of a creditor secured by a lien on property in which the estate has an interest . . . is a secured claim to the extent of the value of such creditor's interest in the estate's interest in such property . . . and is an unsecured claim to the extent that the value of such creditor's interest . . . is less than the amount of such allowed claim. . . .
11 U.S.C. § 506(a). Since the transfer of the funds was a reduction in the value of the MHFA's collateral, the Court believes that the MHFA's secured claim was reduced by the value of the transferred funds  $65,000.00. See Bankruptcy Opinion at 867.
Finally, the Court takes issue with the Bankruptcy Court's rejection of a line of cases that ordered the debtor to restore to the estate a pre-petition payment for legal expenses. Bankruptcy Opinion at 868. The Bankruptcy Court was critical of the "assumption" by these other courts that breach of a HUD regulatory agreement created a separate claim enjoying super priority. Id. at 868. Presumably, the Bankruptcy Court was referring to these courts' positions that HUD's interest in the transferred funds was superior to the interest of the recipients of the funds  the retained attorneys. See In re EES Lambert Assocs., 63 B.R. 174, 175-76 (N.D.Ill.1986); In re Garden Manor Assocs., 70 B.R. 477, 486 (Bankr.N.D.Cal.1987); In re Hil'Crest Apartments, 50 B.R. 610, 612-13 (Bankr.N.D.Ill.1985). The Court, however, points out that in these cases, HUD's interest in the funds was perfected at the time of transfer. Thus, HUD's interest in the funds did not enjoy "super priority" as the Bankruptcy Court asserted, but simply enjoyed "first in time, first in right" priority. See United States v. McCombs, 30 F.3d 310, 321 (2d Cir.1994). The Court views the MHFA's interest similarly.
E. Restoration of the Disbursements
The Regulatory Agreement provides that the MHFA or HUD may apply to any court for specific performance of the agreement, for an injunction, or for any other appropriate relief. Regulatory Agreement, ¶ C(1)(d). Furthermore, the Regulatory Agreement provides that in the case of unauthorized distributions of Project funds, the damages will be the amount of the unauthorized distributions plus interest. Id. at ¶ C(2)(a). In urging the Court to disregard the Regulatory Agreement, the Debtor argues that there is no provision in the Bankruptcy Code that would allow the Court to compel the Debtor to return the disbursements to the estate. Debtor's Brief at 13. Rather, the Debtor contends that the MHFA should have filed an adversary proceeding alleging conversion of the estate's funds. Id.
The Court disagrees. Section 105 of the Bankruptcy Code provides that a bankruptcy court "may issue any order, process, or judgment that is necessary or appropriate *358 to carry out the provisions of this title." 11 U.S.C. § 105(a). Section 105 gives a bankruptcy court the power "to protect its custody of the estate and the administration thereof." In re International Inst. of the Ams., Inc., 63 B.R. 294, 299 (D.P.R.1986), quoting Hernandez v. Borgos, 343 F.2d 802, 807 (1st Cir.1965). Thus, the Court finds that the Bankruptcy Court has sufficient authority to uphold the provisions of the Regulatory Agreement and order repayment of the funds.
Furthermore, repayment of the Project funds would not undermine the Debtor's rights under the Bankruptcy Code. See Debtor's Brief at 16-17. Rather, the Debtor could still avail itself of the Code's protections. As for retaining bankruptcy counsel, the Debtor is free to do so, just not with Project funds. See In re Westwood Plaza Apartments, Ltd., 154 B.R. at 922; In re EES Lambert Assocs., 63 B.R. at 176.
F. Summary
In sum, the Court concludes that the MHFA's security interest in the disbursements was activated upon the Debtor's default, so when the Debtor transferred the disbursements, the MHFA's interest was superior to that of the transferees. The Court also finds that the Bankruptcy Court has the authority to order repayment of the diverted Project funds. Thus, the Court concludes that the Bankruptcy Court erred by failing to order repayment of the diverted Project funds.

V. CONCLUSION
For the above-stated reasons, the Court hereby REVERSES the Bankruptcy Court's Order of January 6, 1994, and the Court hereby REMANDS the case with instructions that the Bankruptcy Court enter an order compelling the Debtor to restore the distributions diverted from the estate.
It Is So Ordered.
NOTES
[1]  Although the mortgage or Regulatory Agreement did not require it, the MHFA gave the Debtor notice of its default. MHFA's Brief at 5-6.
