Why the same stock produces two different profits
When you buy the same item at different prices, you have to decide which cost to charge against a sale. First in, first out charges the oldest cost. Last in, first out charges the newest. The physical goods may move in any order; this is an accounting convention, not a description of what left the shelf.
In a period of rising prices FIFO reports a lower cost of sales, so a higher profit and a higher closing stock value. LIFO does the reverse. Neither is more honest; they answer different questions.