It turns out the liquid gasoline isn't really as flamable as we commonly believe. It requires the right percentage of oxygen to burn. The 20.2% oxygen in our atmosphere will do it, so we commonly experience flamability. Toss a lit match in an open pool of gas, and it burns. Do the same with diesel fuel, and you get a wet match. This is why many marine engines are diesel engines. They don't catch fire as easily when bad things happen out on the water, far away from help.
However, there are lower and upper limits (LEL - lower explosive limit and UEL - upper explosive limit) of oxygen beyond which gasoline won't burn. Too much or too little, and no combustion. (Of course, too high a % oxygen will "burn" all by itself!) A fuel pump emersed in gasoline provides no oxygen, and so the environment is below the LEL. Hence the liquid gasoline can be pumped as an incompressible fluid, and at the same time can be used to transfer heat generated by friction away from the pump, without the danger of "catching fire" in the gas tank.
Despite this, many race cars use external fuel pumps (outside of the gas tank) for ease of maintenance and replacement. They pump higher volumes at higher pressures and have a correspondingly higher failure rate. External pumps have been tried on motorcycles, but they are usually more hassel than they are worth, given limited space to place them where they can get enough airflow for adequate cooling. The internal configuration is just more compact and easier to keep cool - as long as you don't run it dry (very often?).
1990 Honda NT-650 Hawk-GT
Never doubt that a small group of thoughtful, committed citizens can change the world;
indeed, it's the only thing that ever has. - Margaret Mead