Are companies producing custom molded LEGO pieces legally entitled to do so?
from the german wikipedia entry (translated with my poor english-skills):


The Federal Court of germany opened the market for LEGO-like bricks on december 2nd 2004
The European Court of Justice decided in september 2010 that LEGO-Bricks can be copied as they aren't protected by patents anymore


so at least in europe there doesn't seem to be a problem in producing custom bricks and exact copies of LEGO-bricks.