In How Many Ways can 5 Letters be Mailed in 3 Mailboxes, if each letter can be mailed in any of the Mailboxes? The answer to this is 3^5
Explanation: 1st Letter can be posted in any of the 3 mailboxes, 2nd letter can also be posted in
any of the 3 Mailboxes and so on...
         so, total possible ways=3*3*3*3*3

I understood this explanation, but;
My Doubt: Why is the answer not 5^3 ?
I mean, any of the 5 letters can be posted in 1st Mailbox, similarly, any of the 5
letters can be posted in 2nd Mailbox, same goes for 3rd Mailbox.
         so, total possible ways= 5*5*5

Where am I going wrong?
For the given case: Find the total no. of ways in which a 3 digit number can be formed
with the digits- 2,4,9,8,5 , given repetition of digits is allowed.
Here, the unit's place has 5 choice of numbers, similarly the tens place has 5 choices and so on.
        so, total ways=5*5*5

If this is correct, then why in the above original question, this method or logic is not available?
I am new to this, please explain where I am going wrong? What i am missing?
NOTE: I know this question is already asked in the community before, but my doubt , which I have discussed, is not addressed anywhere, Please dont mark as DUPLICATE
 A: In the first explanation, each decision can be made independently. If the first letter is put into the third box, then the second letter can be but into any of the three mailboxes, including the third.
With your explanation, this is not the case. For instance, if letters $1$ and $4$ are placed into the second mailbox, then it is no longer possible to place letter $1$ into box $2$. So, the multiplication rule does not apply.
A: The difference is that when you deliver the first letter to one of the mailboxes you have 4 remaining letters, not 5, but you still have 3 mailboxes every time and every time you have to make the same kind of choice (with the same conditions).
In other words, you repeat exactly the same action (deliver a letter in one of the three mailboxes) 5 times, and each action is independent of the rest of the actions, that is why you have a product of the possible outcomes (3 options) 5 times. The argument with the mailboxes does not work because you do not have the same situation repeated 3 times.
