As close as possible to the motor is generally better for technical reasons and cost (if you are using screened cable). However, a point not mentioned is the environment where the load is. If, for example, the motor is outside on a rooftop or a cruasher motor in a quarry etc, then it might be more practical and cost effective to mount the VFD in a cleaner or safer environment away from the motor. Restrictions on motor cable length are both technical (as mentioned) but also, depending on your country location, limited to compliance to EMC restrictions. Countries in Europe for instance and Australia where compliance with EMC laws is mandatory require the manufacturer to provide limits on motor cable length to ensure compliance with the specific radiated and conducted levels of EMC categories.
If you are in the US then you are probably ok, nobody seems to care about EMC and nobody seems to fit filters..another long discussion.