Millions in tax lost through lettings loophole