An equation is any expression with an equals sign, so your example is by definition an equation. Equations appear frequently in mathematics because mathematicians love to use equal signs.
A formula is a set of instructions for creating a desired result. Non-mathematical examples include such things as chemical formulas (two H and one O make H2O), or the formula for Coca-Cola (which is just a list of ingredients). You can argue that these examples are not equations, in the sense that hydrogen and oxygen are not "equal" to water, yet you can use them to make water.
Mathematicians have long since realized that when it comes to numbers, certain formulas can be expressed most succinctly as equations. For example, the Pythagorean Theorem $a^2+b^2=c^2$ can be thought of as a formula for finding the length of the side of a right triangle, but it turns out that such a length is always equal to a combination of the other two lengths, so we can express the formula as an equation. The key idea is that the equation captures not just the ingredients of the formula, but also the relationship between the different ingredients.
In your case, "mpg = distance/gallons" is best understood as "a formula in the form of an equation", which means that in this instance the two words are interchangeable.