In SDS-PAGE, why are the sample buffer and running buffer different in concentration?
The reason why the sample buffer is more concentrated (typically 2x or 5x depending on your protein concentration) is its dilution when you mix it with the sample. You mix 4 parts of your sample and 1 part of 5x sample buffer, so that the final concentration of this buffer is 1x.

If you use 1x sample buffer together with the same amount of sample, the final concentration of the sample buffer would be 0.5x, if you do the same 4+1, it would only be 0.2x in the end.

This dilution is too strong and the buffer will not fulfill its purpose, the complete denaturation of all proteins in the sample, so that their distribution on the gel depends only on their molecular weight and not also on their tertiary/quarternary structure.

Using a 5x buffer allows you to add a lot of sample when diluting it to 1x without changing the concentration of the protein too much. It also allows to load larger amounts of sample compared to 2x buffer, interesting when the protein concentration is low.

The running buffer is not further diluted by adding sample, so that it has to be diluted to 1x in order to have the right ionic strength. Since these are often used in big quantities in the lab, it is more convenient to prepare concentrated buffers in smaller quantities and dilute them before usage than preparing big tanks of buffer.