Sometimes the basic principle can be best understood by looking at extremes. For example, consider an airplane with a normal cruise speed of 100 kts, a best range speed of 80 knots and a max speed of 120 knots. If this airplane were flying into an 80 knot headwind, and elected to use max range speed, 80 knots, it would be a really, really long leg. Rather doubtful that you'd have enough fuel to fly for infinity. On the other hand, the 120 knot max speed would give you a 40 knot ground speed which beats 0 knots any day. So, yes, wind does count when determining best speed for max range.
Bill Harrelson
N5ZQ 320 2,150 hrs
N6ZQ IV 400 hrs