New York state tax loophole put millions in builders' pockets