When a reader hears words in other works of literature that echo the words of Shakespeare's Hamlet, the reader is hearing an allusion to Hamlet. One should find it quite ironic that two of the most quoted lines from Hamlet are actually words of the fool, Polonius, yet are often quoted as elements of wisdom. Still, let's take them on their own and separate them from their foolish speaker. In Polonius's words of advice to his son, Laertes, before he travels abroad by boat, Polonius advises, "Neither a borrower nor a lender be." The gist of the advice is there, but one can get more out of it if one includes the next couple of lines:
Neither a borrower nor a lender be, / For loan oft loses both itself and friend, / And borrowing dulleth edge of husbandry.
Put simply, Polonius is instructing Laertes not to borrow or lend money. Couple the allusion with the following lines, and the reader can see that if Laertes (or anyone) were not to take this advice, not only would the money be lost but also the friend who took out the loan (or did the borrowing). In the last part of this idea quoted above, Polonius admits that saving your money and being a frugal person almost never involves borrowing more of said money.