Literally, "the whole cloth" here refers to cloth all in one piece as manufactured or woven, before it has been cut. The figurative sense—where "made out of whole cloth," or a similar phrase, means "completely made up" or "completely without basis"—first appears in 19th-century American English. The expression originated from the notion that a story made out of whole cloth is one woven completely of falsehood with no break in the pattern from beginning to end.
In early examples of the expression, there is often a direct reference to a lie or an untruth of some sort, as in "What a fib! It's all made out of whole cloth." Early on, however, this direct reference to untruth was often dropped and "made of whole cloth" was understood to be in reference to a lie.
It's not only a compelling portrait of one of baseball's greatest players, but it also reveals that much of the conventional wisdom about Cobb—that he was an angry and violent bigot—was made up out of whole cloth by an unscrupulous so-called biographer looking to sell books and cash in.
— Ryan Mills, The Naples (Florida) Daily News, 7 Aug. 2017
Gradually, the reference became even more oblique; "made up of whole cloth" could simply mean "completely made up," as in a made-up word or an original tale.
As for Shakespeare, he will certainly survive all the clumsy love and attention, the romanticization of how he worked, the modern assumption that he invented his plots out of whole cloth. But it bears reminding that his true glory lies in his plays, not in his life story.
— Charles McNulty, The Los Angeles Times, 23 Jan. 2018
Another use of the phrase gives it even broader applications. That which is "created" and "invented" (out of whole cloth) is not always a thing composed of words.
In my years as a high school teacher and an observer of the national public school scene, I can't remember hearing of a course which was created out of whole cloth by some agency outside the schools.
— David Safier, The Tucson Weekly (Arizona), 20 Nov. 2017