The tag 4F comes from the card. The terminal (card reader) will only pass this TLV from the card. It will never create it or change it. If the card doesn't have a value for this tag, the reader will just output an empty TLV (4F00).
When the reader reads the record of Payment System Directory from the card, if the value of the 4F tag is returned by the card, the reader will save it to the 4F and 84 tag (so the values of 4F and 84 are the same) and then copy the value to the 9F06 tag.
If Payment System Directory is not supported by the card, then the AID will be returned in tag 84 and the value will also being copied to the 9F06 tag. So if the returned value of the 4F tag is empty, you can use the value in the 84 or the 9F06 tag.
Because of this, the best practice is to use tag 84 or 9F06 for printing the AID on the receipt, not the 4F tag