In an action to foreclose a mortgage, the defendant Marie Holdings, Inc., appeals, as limited by its brief, from so much of an order of the Supreme Court, Nassau County (Winslow, J.), entered September 13, 2011, as granted that branch of the motion of the defendant Lawrence Biggio which was to direct the Treasurer of the County of Nassau to release to him surplus funds from the sale of the subject property in the principal sum of $282,644.47, and denied that branch of its cross motion which was to direct the Treasurer of the County of Nassau to release those surplus funds to it.
Ordered that the order is affirmed insofar as appealed from, with one bill of costs payable by the appellant to the respondent.
In the course of divorce proceedings between Jacqueline Biggio (hereinafter the wife) and Lawrence Biggio (hereinafter the husband), both of whom are defendants in this foreclosure action, the matrimonial court entered an order (hereinafter the restraining order) restraining and enjoining the wife and the husband from, inter alia, transferring any marital property except in the ordinary course of business or for day-to-day living expenses. Despite that order, the wife encumbered the mar*674ital home with a junior mortgage in favor of the defendant Marie Holdings, Inc. (hereinafter Marie Holdings). In an order dated April 13, 2006, the matrimonial court granted the husband’s motion to hold the wife in contempt for violating the restraining order, and this Court affirmed the April 2006 order, as modified on appeal (see Biggio v Biggio, 41 AD3d 753 [2007]).
While the matrimonial proceedings were pending, Emigrant Mortgage Company, Inc. (hereinafter Emigrant Mortgage), the holder of the first mortgage on the marital home, commenced this action to foreclose on its mortgage, and the marital home was ultimately sold at a foreclosure sale. The sale yielded funds sufficient to satisfy Emigrant Mortgage’s lien plus a surplus of approximately $490,000, which was deposited with the Treasurer of the County of Nassau (hereinafter the county treasurer). The husband, the defendant E*Trade, which held a second mortgage, and Marie Holdings, which held a third mortgage, among others, asserted claims to the surplus. The record developed in the foreclosure proceeding established that Marie Holdings, via the attorney who acted as its agent with respect to its mortgage, knew or should have known that the wife was restrained and enjoined from encumbering the marital home with a mortgage except under certain limited circumstances.
In a decision issued in the matrimonial action determining the equitable distribution of the property of the husband and the wife (hereinafter the equitable distribution decision), a Court Attorney Referee (hereinafter the referee) determined that the wife had used the proceeds of the Marie Holdings mortgage loan for her individual benefit rather than for the benefit of the marriage. Consequently, the referee determined that the Marie Holdings mortgage was the wife’s individual debt. Based upon these determinations, the referee concluded that the husband’s claim to the surplus funds was superior to that of Marie Holdings. Thereafter, the referee issued a judgment upon the equitable distribution decision which, among other things, ordered and adjudged that any surplus funds remaining after E*Trade’s claim was satisfied were to be distributed solely to the husband.
In the foreclosure action, the husband moved, inter alia, to direct the county treasurer to release to him surplus funds in the principal sum of $282,644.47. In support of his motion, he submitted, among other things, the equitable distribution decision and the judgment entered upon it. Marie Holdings opposed the motion, and cross-moved, inter alia, to direct the county treasurer to release those surplus funds to it, contending that it had a secured interest in the marital home and was therefore *675entitled to satisfaction of its lien before any surplus was distributed to the husband. It further objected to the judgment of the referee entered in the matrimonial action insofar as the judgment affected its interest, as it was not a party to that action and had no opportunity to be heard therein. In an order entered September 13, 2011, the foreclosure court, among other things, determined that the husband was entitled to the surplus funds and granted that branch of his motion which was to direct the county treasurer to release the funds to him.
“The surplus funds of a foreclosure sale stand in the place of the land for all purposes of distribution among persons having vested interests or liens upon the land” (NYCTL 1999-1 Trust v NY Pride Holdings, Inc., 68 AD3d 952 [2009]; see Chase Manhattan Mtge. Corp. v Hall, 18 AD3d 413, 414 [2005]; Fremont Inv. & Loan v Kinlaw, 15 AD3d 345 [2005]; First Fed. Sav. & Loan Assn. of Rochester v Brown, 78 AD2d 119, 123 [1980]). Accordingly, “[s]urplus money takes the place of the equity of redemption and only one who had a vested estate or interest in the land sold under foreclosure which was cut off by the foreclosure sale is entitled to share in the surplus money with priority in each creditor determined by the filing date of his lien or judgment” (First Fed. Sav. & Loan Assn. of Rochester v Brown, 78 AD2d at 123; see NYCTL 1998-1 Trust v Gab-bay, 16 Misc 3d 732, 735 [2007]; Roosevelt Sav. Bank v Goldberg, 118 Misc 2d 220, 221 [1983]).
Although Marie Holdings established its prima facie entitlement to a share of the surplus based upon its status as a junior mortgagee by producing the mortgage documents (see LZG Realty, LLC v H.D.W. 2005 Forest, LLC, 87 AD3d 727, 729 [2011]; Washington Mut. Home Loans, Inc. v Jones, 27 AD3d 728, 730 [2006]), the record establishes that Marie Holdings’ attorney, who acted as its agent with respect to its mortgage, knew or should have known of the restraining order, which, with limited exception, enjoined the wife from encumbering the marital home. The attorney’s knowledge is imputed to Marie Holdings even if the attorney “act[ed] less than admirably [or] exhibited] poor business judgment” (Kirschner v KPMG LLP, 15 NY3d 446, 465 [2010]).
Contrary to Marie Holdings’ contention, the matrimonial court had authority to determine that the husband was entitled to the surplus funds as part of the equitable distribution of the marital property (see Kosovsky v Zahl, 257 AD2d 522, 522-523 [1999]; Du Jack v Du Jack, 243 AD2d 908, 910 [1997]; Helen A.S. v Werner R.S., 166 AD2d 515, 517 [1990]; see also NYCTL 1999-1 Trust v NY Pride Holdings, Inc., 68 AD3d at 953; but see *676Goldman v Goldman, 95 NY2d 120, 122-123 [2000]). Thus, notwithstanding the secured interest Marie Holdings acquired in the marital home by virtue of the mortgage the wife gave to it, because the wife undertook the mortgage in violation of the restraining order (see Biggio v Biggio, 41 AD3d at 754), and because Marie Holdings’ agent knew or should have known of the restraining order, its interest in the surplus funds was properly limited to the wife’s interest therein (see Catalano v Catalano, 158 AD2d 570, 572 [1990]). The matrimonial court, in its discretion, divested the wife of that interest based upon her conduct.
The parties’ remaining contentions are without merit.
Accordingly, the foreclosure court properly granted that branch of the husband’s motion which was to direct the county treasurer to release to him surplus funds from the sale of the marital home in the principal sum of $282,644.47, and properly denied that branch of Marie Holdings’ cross motion which was to direct the county treasurer to release those surplus funds to it. Skelos, J.P., Leventhal, Cohen and Miller, JJ., concur.