Section 27. Where a trade-in of a motor vehicle or trailer is received by a dealer in such vehicles holding a valid vendor's registration, upon the sale of another motor vehicle or trailer to a consumer or user, the tax shall be imposed only on the difference between the sales price of the motor vehicle or trailer purchased and the amount allowed on the motor vehicle or trailer traded in on such purchase. When any such motor vehicle or trailer traded in is subsequently sold to a consumer or user, the tax provided for in this chapter shall apply. For the purposes of this section, the term ''motor vehicle'' shall mean a self-propelled vehicle designed for use and used primarily upon the highway. The term ''motor vehicle'' shall also mean a ''snow vehicle'' and a ''recreation vehicle'' as defined in section 20 of chapter 90B.