If all the data is above or below the line of best fit, then the line of the best fit is not the 'best'. What if I increased the $y$-intercept of the line of best fit just slightly? Then, all of the points would be closer to the line, and the line would fit better.
The line of best fit is more properly termed the least squares regression line (LSRL). Let's call this line $y=f(x)$.
The basic idea is that for a given $x-$value, the distance between the point and $(x,f(x))$ should be as small as possible. More precisely, this distance is squared. The squaring means that more weight is given to large discrepancies in distance. Allow me to elaborate:
Let's say you have two points $(x_1,y_1)$ and ($x_2,y_2)$. The distances for each of the points are $|f(x_1)-y_1|$ and $|f(x_2)-y_2|$ respectively. Using these distances, I can come up with a LSRL 'score':
$$
\text{score}=|f(x_1)-y_1|^2+|f(x_2)-y_2|^2
$$
We want this score to be as low as possible. Note that squaring the distances has a nice effect: it means that one discrepancy of $4$ units is valued as worse than two discrepancies of $2$ units as $4^2>2^2+2^2$.
This conforms with our intuition of what the LSRL should look like. Hence, why the LSRL is based on this principle.
Going back to your question, the LSRL is lower when the line is between the dots. You really don't want there to be relatively large distances as in the diagram shown. These large distances would be magnified, giving us a high LSRL 'score'.
On an entirely pragmatic note, if you simply want to find the correct LSRL for the data, then there are many calculators on the web that do this for you—these calculators tell you what the equation of the LSRL is.