The meaning of the two sentences is the same.
The choice will depend purely on personal preference and possibly on the context.
If John says to Peter: Have you read any of the books by X?
Peter might reply: I don't like the books by X, merely because John has used the in his question. But he could equally have omitted the article. There is no difference in meaning.
The definite article is generally used when the item/person being referred to has already been identified.
But in cases like these, it is understood that books by X means the books that X has written.