When you define a local variable as static and equate it to something you are telling it the starting value only. This value only gets assigned once.
It is functionally the same as a global variable, except the scope (where you can access it from) is more limited.
The code to assign the value to the static variable is run during the startup phase (not the setup function - before even that runs) - a process called "crt0
" for "C RunTime phase 0". This copies all the values for the pre-set (static and global) variables from flash into RAM, and that is the only time these initialization values are ever assigned.
In effect the "=0" of your static declaration is not performed there, but right at the start of the program before even setup() runs.