MDMA was patented in 1914 (patent #274.350) by the German pharmaceutical company Merck. Merck filed for the patent in December 1912, and it was approved in May 1914. The patent is now expired.
Source: Holland, J. (Ed.). (2001). Ecstasy: the complete guide. Inner Traditions/Bear & Co.