This appears in Twain's posthumous The Refuge of the Derelicts (1905), but it had already been published by other writers.
The earliest citation found in Google Books is a 1872 article by Richard Bowker: "Our Crime Against Crimes" https://books.google.com/books?id=YZgBAAAAYAAJ&pg=PA68&dq=The+lack+of+money+is+the+root+of+all+evil&hl=en&sa=X&ved=0ahUKEwjWi5DE1crLAhUI3mMKHeSdB0YQ6AEIKzAB#v=onepage&q=%22lack%20of%20money%22&f=false, in The Herald of Health, vol. 19 no. 2, New York: Wood & Holbrook, February 1872. The saying is placed within quotation marks, perhaps indicating that it was already well-known.
A precursor is found in an article from 1859 https://books.google.com/books?id=gpdEAQAAMAAJ&pg=PA209&dq=The+lack+of+money+is+the+root+of+all+evil&hl=en&sa=X&ved=0ahUKEwjWi5DE1crLAhUI3mMKHeSdB0YQ6AEINTAD#v=onepage&q=%22lack%20of%20gold%22&f=false: It is very well to repeat, parrot-like, the old axiom that “the love of gold is the root of all evil;” but it is very certain that in truth—the lack of gold is the great incentive to crime.
Disputed