From R. G. Collingwood, The Principles of Art (with thanks to David Pierce, who recommended me the book):

This is not because (as Oscar Wilde said, with his curious talent for just missing a truth and then giving himself a prize for hitting it) ‘all art is quite useless’, for it is not; a work of art may very well amuse, instruct, puzzle, exhort, and so forth, without ceasing to be art, and in this ways it may be very useful indeed. It is because, as Oscar Wilde perhaps meant to say, what makes it art is not the same as what makes it useful.

Of course, G. H. Hardy’s famous saying immediately crosses mind:

The ‘real’ mathematics of the ‘real’ mathematicians, the mathematics of Fermat and Euler and Gauss and Abel and Riemann, is almost wholly ‘useless’.

Now, rephrasing of Collingwood’s maxim for mathematics is obvious:

What makes it mathematics is not the same as what makes it useful.