Each district court shall have civil jurisdiction of actions local or transitory begun in such court which should have been brought in some other district court, to the extent that the court in which the action is begun may try and dispose of the case if the question of venue is waived or, if not waived, the court may, on motion of any party, order the action, with all papers, whether in physical or electronic form, relating thereto, to be transferred for trial or disposition to any other district court in which the action might have been commenced. The defendant in said action shall be entitled to costs and such reasonable attorney's fees as may be allowed by the court. Said action shall thereupon be entered and prosecuted in such court as if it had been originally commenced therein, and all prior proceedings otherwise regularly taken shall thereafter be valid. An additional entry fee for entry in the court to which the case is transferred shall be paid to the clerk of the transmitting court for transfer with the papers.
Mass. Gen. Laws ch. 218, § 2A