
387 B.R. 353 (2008)
John E. SULLIVAN, Debtor.
Lynne F. Riley, Chapter 7 Trustee, Plaintiff-Appellee,
v.
John E. Sullivan, Defendant-Appellant.
BAP No. MB 07-057. Bankruptcy No. 05-24337-JBR. Adversary No. 06-01412-JBR.
United States Bankruptcy Appellate Panel of the First Circuit.
May 9, 2008.
*355 Gary E. Evans, Esq., on brief for Defendant-Appellant.
Lynne F. Riley, Esq. and Maria C. Furlong, Esq., on brief for Plaintiff-Appellee.
Before VOTOLATO, CARLO and TESTER, United States Bankruptcy Appellate Panel Judges.
VOTOLATO, Bankruptcy Judge.
John E. Sullivan ("Debtor") seeks review of a judgment of the United States Bankruptcy Court for the District of Massachusetts denying his motion for summary judgment, granting the Chapter 7 Trustee's motion for summary judgment, and further ordering: (1) that an unrecorded mortgage on the Debtor's house (the "property") is avoided; (2) the avoided mortgage is preserved for the benefit of the bankruptcy estate; and (3) the Debtor's homestead exemption claim is subordinated to the estate's interest in the property. For the reasons discussed below, we affirm.

BACKGROUND
The Debtor purchased the property in October 2000, and in March 2004 refinanced with Ameriquest Mortgage Company ("Ameriquest") in the amount of $426,000. Ameriquest failed to record, and the mortgage remained unrecorded as of the date the bankruptcy petition was filed.
On October 14, 2005, the Debtor filed a declaration of homestead, and two days later he filed a petition under Chapter 7 of the Bankruptcy Code. Lynne F. Riley, Esq., was appointed Chapter 7 Trustee ("Trustee").
The Trustee filed adversary proceedings against both the Debtor and Ameriquest for a determination of the priority and extent of the parties' respective interests in the property. Count I of the Complaint requested avoidance of Ameriquest's mortgage pursuant to § 544(a)(3), and Count II sought to preserve that mortgage for the benefit of the bankruptcy estate pursuant to § 551. In Count III, the Trustee asked *356 for a ruling that the Debtor's homestead exemption was subordinate to the estate's interest in the property under § 551 and § 522. Both the Debtor and Ameriquest objected to the relief sought.
In June 2007, the Trustee moved for summary judgment as to Counts II and III of the Complaint, and later moved to include Count I. The Debtor filed an opposition to the Trustee's motion and requested summary judgment in his favor. The matter was scheduled for hearing in August 2007.
Prior to the scheduled hearing on cross motions for summary judgment, the Trustee and Ameriquest's assignee, American Guaranty and Liability Insurance Company ("American"), entered into a stipulation whereby the parties agreed, among other things: (1) that judgment be entered in favor of the Trustee against American and Ameriquest on all counts of the Complaint; and (2) American would amend its proof of claim from secured to unsecured status. Notice of the proposed stipulation was properly given, no objections were filed, and on July 18, 2007, the bankruptcy judge approved the agreement.
On August 28, 2007, the bankruptcy court heard the parties' cross motions for summary judgment. The Trustee argued that, on the undisputed facts and based on the relevant statutes and case law, she was entitled to judgment as a matter of law, while the Debtor contended that the Trustee's pleadings amounted to an attempt to make an untimely objection to his claimed homestead exemption. He also argued that because of the reference in the stipulation to American having an unsecured claim in the bankruptcy case, the Trustee could preserve for the estate only an unsecured claim, which would be subordinate to the Debtor's homestead claim. At the conclusion of the hearing, the bankruptcy court entered orders (1) denying the Debtor's motion for summary judgment (Docket # 66), and (2) granting the Trustee's amended motion for summary judgment (Docket # 67). In the order granting summary judgment for the Trustee, the bankruptcy court noted its approval of the stipulation between the Trustee and American which provided, inter alia: (1) the unrecorded mortgage on the property is avoided; (2) the avoided mortgage is preserved for the benefit of the bankruptcy estate; and (3) the Debtor's homestead exemption is subordinated to the estate's interest in the property. The bankruptcy judge also stated that the Debtor had notice and opportunity to object to the proposed stipulation and, having failed to do so, "may not now seek to undo its terms and provisions." The bankruptcy court also ruled that even if the Debtor had timely objected to the stipulation, the result would be the same, given the undisputed material facts and relevant case law. Finally, the bankruptcy court noted that the Trustee was not objecting to the Debtor's homestead claim, but was merely seeking to enforce the same rights against the Debtor that the mortgagee had, including the priority provisions of the Massachusetts homestead exemption statute with respect to a lien that predates the homestead declaration. That statute says that the estate of homestead is not effective as against the mortgagee, when property is subject to a mortgage that was executed prior to a declaration of homestead. See Mass. Gen. Laws ch. 188, §§ 1(2), 5, and 6.
The bankruptcy court also entered a separate judgment (Docket # 68) stating: (1) the unrecorded mortgage on the property is avoided; (2) the avoided mortgage is preserved for the benefit of the bankruptcy estate; and (3) the Debtor's homestead exemption is subordinated to the estate's interest in the property. On September *357 7, 2007, the Debtor filed a notice of appeal of that judgment.

JURISDICTION
A bankruptcy appellate panel is duty-bound to determine that it has jurisdiction before proceeding to the merits, even if the issue is not raised by the litigants, see In re George E. Bumpus, Jr. Constr. Co., 226 B.R. 724 (1st Cir. BAP 1998), and it may hear appeals from "final judgments, orders and decrees ... or with leave of the court, from interlocutory orders and decrees of bankruptcy judges entered in cases and proceedings referred to the bankruptcy judges under § 157 of this title." 28 U.S.C. § 158(a); see also Fleet Data Processing Corp. v. Branch (In re Bank of New Eng. Corp.), 218 B.R. 643, 645 (1st Cir. BAP 1998). "A decision is final if it `ends the litigation on the merits and leaves nothing for the court to do but execute the judgment,'" Bank of New Eng., 218 B.R. at 646 (citations omitted), while an interlocutory order "`only decides some intervening matter pertaining to the cause, and which requires further steps to be taken in order to enable the court to adjudicate the cause on the merits.'" Id. (quoting In re American Colonial Broad. Corp., 758 F.2d 794, 801 (1st Cir.1985)).
An order granting a motion for summary judgment is a final order that ends the litigation on the merits of the complaint. See Burrell v. Town of Marion (In re Burrell), 346 B.R. 561 (1st Cir. BAP 2006); Ragosa v. Canzano (In re Colarusso), 295 B.R. 166, 171 (1st Cir. BAP 2003) (recognizing that an order denying a motion for summary judgment that also grants an opposing party's cross-motion for summary judgment is a final order, because it ends the litigation on the merits), aff'd, 382 F.3d 51 (1st Cir.2004).

STANDARD OF REVIEW
Appellate courts generally apply the clearly erroneous standard to findings of fact, and de novo review to conclusions Of law. See TI Fed. Credit Union v. Del-Bonis, 72 F:3d 921, 928 (1st Cir.1995); Western Auto Supply Co. v. Savage Arms, Inc. (In re Savage Indus., Inc.), 43 F.3d 714, 719-20 n. 8 (1st Cir.1994). Here, the bankruptcy court's relevant determinations are conclusions of law, which are subject to de novo review. See Burrell, 346 B.R. at 566-67 (citing Razzaboni v. Schifano (In re Schifano), 378 F.3d 60, 66 (1st Cir. 2004); Desmond v. Varrasso (In re-Varrasso), 37 F.3d 760, 763 (1st Cir.1994)).

DISCUSSION
Section 544(a)(3)[1] vests the trustee with the powers of a bona fide purchaser of real property for value, and allows the trustee to invalidate unperfected security interests. See 11 U.S.C. § 544(a)(3); In re Garrido Jimenez, 370 B.R. 878, 881 (1st Cir. BAP 2007) (an unrecorded deed was ineffective against the trustee in his strong arm capacity as a hypothetical bona fide purchaser); Wegner v. Letcher (In re Wegner), 210 B.R. 799, 801 (Bankr.D.N.D. 1997) (mortgagee failed to record the mortgage, so the trustee had the rights of *358 a bonafide purchaser of real property for value, resulting in the trustee invalidating the security interest), aff'd, 162 F.3d 1166 (8th Cir.1998). "[N]o other purpose would have been consistent with the principal function of the `strong arm' clause-to invalidate unperfected security transfers." Rodolakis v. Pedone (In re Belba), 226 B.R. 738, 744 (Bankr.D.Mass.1998). In the present case, the mortgage in question was unrecorded as of the date of the petition, and under § 551 of the Bankruptcy Code, "[a]ny transfer avoided ... under section 544 ... is preserved for the benefit of the estate." 11 U.S.C. § 551; see also In re Guido, 344 B.R. 193, 197 (Bankr.D.Mass. 2006) ("The Bankruptcy Code provides for the automatic preservation of avoided transfers for the benefit of the estate"); Carvell v. Lafayette (In re Carvell), 222 B.R. 178, 180 (1st Cir. BAP 1998) (preservation for the benefit of the estate puts the estate in the shoes of the creditor whose lien was avoided, the trustee assumes the position that the lien holder previously held, and the mortgage is treated as if it had not been avoided, as between the debtor and the trustee). Similarly, in this case, after avoiding American's unrecorded mortgage, the Trustee assumed the creditor's prior secured position and the Debtor has no more protection against the Trustee in bankruptcy than the Debtor would have had from the mortgagee under non-bankruptcy law. See In re Guido, 344 B.R. at 198.
Further, and importantly in this appeal, under § 101(37) of the Code, a lien is "a charge against or interest in property to secure payment of a debt or performance of an obligation," 11 U.S.C. § 101(37), and while the classification of a lien is a matter of federal law, "the issue of whether a particular mortgage is a `charge against or interest in property to secure payment of a debt'... is one of state law." In re Smith, 315 B.R. 636, 640 (Bankr. D.Mass.2004). In Massachusetts, a mortgagee is given a lien to secure the performance of an obligation or the payment of money, and while an unrecorded mortgage is unenforceable as against third parties, the lien remains valid between the mortgagee and the mortgagor. See Mass. Gen. Laws. ch. 183, § 4 (1986); In re Smith, 315 B.R. at 640. Thus, under Massachusetts law, American's unrecorded mortgage remains valid against the Debtor, and when avoided by the Trustee pursuant to § 544(a)(3), the mortgage is preserved for the benefit of the estate. See 11 U.S.C. § 551.
The facts in In re Guido are virtually identical to those in the instant case, where the debtor executed a mortgage, but the mortgage was not recorded until after she filed a declaration of homestead. 344 B.R. at 194-95. In the bankruptcy court, the trustee avoided the mortgage as a preferential transfer, pursuant to an agreement between the trustee and the lender, whereby the lender became an unsecured creditor, and the secured position formerly enjoyed by the lender was preserved for the benefit of the estate. Id. at 195. Thereafter the debtor sought to compel the trustee to abandon the mortgage, id., arguing that because she recorded the declaration of homestead before the mortgage was recorded, the order of events placed her homestead claim ahead of the trustee, id., and that because the equity in the property was less than the claimed exemption, the mortgage was burdensome to the estate. Id. at 195-96. The court disagreed, holding that the avoided mortgage was preserved for the benefit of the estate pursuant to § 551, id. at 197-98, placing the trustee in the secured position formerly held by the mortgagee. Id. at 198. The court also ruled that because the unrecorded mortgage was executed prior to the recording of the declaration *359 of homestead, the debtor had no greater protection against the trustee than she would have had against the mortgagee outside of bankruptcy. Id. Accordingly, the trustee, standing in the place of the previously secured mortgagee, had priority over the debtor's homestead exemption claim. Id. at 200.
The court in In re Guido also stated that the only way for the debtor to assert his exemption rights after the trustee avoided the transfer for the benefit of the estate would be through § 522(g) of the Bankruptcy Code. Id. at 197. Under § 522(g), "[n]otwithstanding ... § 551, the debtor may exempt ... property that the trustee recovers ... (1)(A) if such transfer was not a voluntary transfer of such property by the debtor." 11 U.S.C. § 522(g). Since the conveyance by the debtor was voluntary, he acquired no exemption rights under § 522(g). See In re Guido, 344 B.R. at 198.
The Debtor also argues here that the result of the stipulation between the Trustee, American, and Ameriquest was to transform American's status to that of an unsecured creditor, and that the Trustee Was able to preserve for the estate only American's unsecured claim, which is subordinate to the Massachusetts homestead exemption. This argument fails for several reasons: First, the Trustee's successful avoidance of the mortgage does not render her an unsecured creditor. See id. American's amended proof of claim as an unsecured creditor is irrelevant for these purposes, and by avoiding the transfer and preserving the mortgage for the benefit of the estate under § 551, the Trustee clearly assumed American's former position as a secured creditor. See id. Second, "the only way for a debtor to claim an exemption in property that has been preserved for the benefit of the estate is through § 522(g) of the Code." Id. As previously noted, under § 522(g), the debtor does not have an exemption right as to property preserved for the estate under § 551, when the transfer was voluntary. 11 U.S.C. § 522(g); see In re Guido, 344 B.R. at 197. Any other conclusion would defeat the purpose of § 551, by allowing a debtor, after the trustee avoided a voluntary conveyance, to exempt property and gain the equity for himself. See In re Wegner, 210 B.R. at 802 (a voluntary conveyance of mortgage by the debtor, but subsequently recovered by the trustee under § 551, could not be exempted). As the Trustee correctly noted during oral argument, if the Debtor's homestead exemption were given priority over the estate's interest in the property, general creditors would receive nothing. This would be an illogical result, considering that outside of bankruptcy, as between the mortgagee and mortgagor, American's unrecorded mortgage would have been satisfied before the Debtor could have received any funds.
Additionally, the Massachusetts homestead statute provides that when property is subject to a mortgage that was executed before a declaration of homestead was filed, the claim of homestead is not effective as against the mortgagee. Mass. Gen. Laws. ch. 188, § 6 (1986); In re Guido, 344 B.R. at 198. Since American's mortgage was executed prior to the Debtor filing his declaration of homestead, the homestead claim is not effective as against either American or the Trustee standing in the shoes of American. Finally, even if the homestead declaration were filed prior to the date of the mortgage, the mortgage itself provides that any claim of prior homestead is waived.
For all of the foregoing reasons, we agree with the bankruptcy court's conclusions and rulings herein. Accordingly, the *360 bankruptcy court's orders are hereby AFFIRMED, and the appeal is DENIED.
NOTES
[1]  The trustee shall have, as of the commencement of the case, and without regard to any knowledge of the trustee or to any creditor, the rights and powers of ... or may avoid any transfer of property of the debtor or any obligation incurred by the debtor that is voidable by 

...
(3) a bona fide purchaser of real property... from the debtor, against whom applicable law permits such transfer to be perfected, that obtains the status of a bona fide purchaser at the time of the commencement of the case, whether or not such a purchaser exists [and has perfected such transfer].
11 U.S.C. § 544(a)(3).
