If a person who has paid to the estate of a deceased person, or to the commonwealth, any tax or part of a tax imposed on such estate by this chapter, afterward refunds to the estate any of the property upon which such tax was paid, or, in the case of a tax or part of a tax paid to the estate of the deceased, or paid to the commonwealth on account of such estate, if it is judicially determined that the whole or any part of such tax ought not to have been paid, such tax, or the due proportion thereof, shall be repaid to him by the executor, administrator or trustee.
Mass. Gen. Laws ch. 65, § 20