Local minima exists, because the shape of the error mountain is unknown. What sampling based planners are doing, is to calculate the outcome of a certain point in the map. For the input value f(x,y)=z the resulting value z is determined. To get the global minimum of the error function not a single point but all possible values for (x,y) have to be calculated which is not possible on standard-hardware.
The answer to the second question (how to overcome local minima) is called knowledge based planning. That means, a sampling planner is combined with domain specific heuristics. In the case of the RRT planner, this can be done with motion primitives which are sampled. A motion primitive is some kind of abstract input value which helps to reduce the possible numbers of (x,y) values down to a small lexicon of meaningful actions like “move forward”, “stop” and “move left”.