The law is not that absolute in this respect and there have been cases before higher courts accepting "data in exchange for value" contracts under some conditions. There are also legal opinions out there that this is illegal but note that there is a controversy here.