Assuming `xz` honors the standard set of commandline flags - including compression level flags, you could try:

 tar -cf - foo/ | xz -9 -c - > foo.tar.xz