By their original bills in equity the plaintiffs sought (1) specific performance of their alleged agreement to purchase real estate from the defendant Farr, and (2) a conveyance to Farr of the same real estate, which Farr had allegedly conveyed to the defendant Heritage Hall, Inc., without adequate consideration in order to avoid his contractual obligation to the plaintiffs. Both defendants demurred on the ground that the bills failed to allege compliance with G. L. c. 259, Section 1 (the Statute of Frauds) or facts excusing such compliance. The demurrers were sustained. The plaintiffs then moved for leave to file substitute bills in equity alleging additional facts. Their motions were denied by the judge, apparently in the exercise of his discretion. Following the denial of their motions, the plaintiffs moved for the entry of final decrees dismissing their bills "without prejudice" and without costs to either party. The defendant in each case moved for the entry of a final decree dismissing the bill with costs assessed against the plaintiffs. The judge denied the plaintiffs' motions and allowed the defendants' motions, but in each case caused a final decree to be entered dismissing the plaintiffs' bill "with prejudice, without costs" (emphasis supplied). The plaintiffs took exception to the judge's rulings on the motions filed by the parties and appealed from the decree entered in each case. The defendants argue, in effect, that
the dismissals with prejudice were justified under the principle set forth in Martin v. Hunt, 352 Mass. 774 (1967), and Turner v. Dahlberg, 360 Mass. 854 (1971). The judge's discretionary ruling on the plaintiffs' motion for leave to file substitute bills (see Keljikian v. Star Brewing Co. 303 Mass. 53 , 56 ) cannot, however, be construed as a decision on the sufficiency of the allegations contained therein. In determining the correctness of the decrees which were entered, we consider these cases as they stood following the sustaining of demurrers to the original bills. "It is a general rule that a judgment for the defendant founded on a demurrer is not a bar to a second action. The reason for the rule is that such a judgment commonly is based not on the merits but upon the insufficiency of the statement of the cause of action." Whitney v. Whitney, 299 Mass. 547 , 550 (1938). Spector v. Loreck, 342 Mass. 685 , 687 (1961). The demurrer in each of the present cases was grounded solely upon the failure of the plaintiffs' bill to allege facts necessary to state a valid cause of suit. We are of the opinion that these cases fall within the terms of the above-cited rule (see Magaletta v. Millard, 346 Mass. 591 , 596 ) and therefore that it was error to enter final decrees dismissing the bills with prejudice. The decrees entered are to be modified by striking the words "with prejudice" and, as so modified, are affirmed.