Thanks cde I understood everything perfectly.
So when the pin is set to OUTPUT, is the resistor enabled or disabled? Because the way I see it, if the resistor is enabled, having it set to PULL UP and having the output set to LOW would consume a small current that would be a bit unnecessary. It wouldn't change the function of the pin, but it could be a bit wasteful. Here is the drawing I am basing my analisis from, maybe it is wrong:
On the drawing on the right, if Vout was set to LOW there would be a current through the pull up resistor that would serve no purpose.