These #pragma configs
configure settings which live in their own section of flash memory that is outside of your program code. They are available as soon as the PIC gets power, regardless where they are written in your code. This is important because sometimes they are needed before your program is executed.
For example, there are settings to select a clock source and convert it to the actual clock of your PIC. This can't be done in your program code because the clock must correctly configured before your code can run.
Another example is the code protection setting. If this is enabled, it is not possible to read the program memory of the PIC with a programmer. This discourages others from copying program memory and reverse-engineering your code. This can't be done with program code because it's possible put your PIC into programming mode before any of you program code executes, bypassing anything that enables code protection. In this way