This saying refers to the practice in many places of paying for empty bottles returned for recycling- in this cases 5 cents, commonly called a nickle. The money returned was added to the original purchase price of the drink, so the purchaser 'invested' a nickel, expecting to get it back when he returned the empty bottle. If the bottle is broken, the 'investment' is lost.
What this adage is saying is that, if we invest (whether money, time, or something else) in something, and that something is destroyed or for some other reason come to ruin, then our investment will be lost.
It's not saying don't regret the loss, it just says you will lose your "deposit" if the "bottle" gets "broken".
Student or Learner