Depends on the timing of events:
a) If the referee noticed before the player had played his next shot, and was attempting to correct the mistake or was just about to, but the player played his next shot anyway, then it is a foul, penalty equal to the value of the colour in question or 4 points.
b) If the player plays his next shot and only then is the error noticed, then there's no penalty and the ball is assumed to be in the correct place from then on.
c) the exception to this is in the case where a colour is placed on a spot when it shouldn't have been at the end of clearing the six colours. In that case, once the error is noticed the ball is removed at the earliest opportunity (again, if the referee notices before a shot then a foul occurs, and if he notices after a shot then there is no foul).