It says in the Posuk:
וּכְתַבְתָּם עַל מְזוּזוֹת בֵּיתֶךָ וּבִשְׁעָרֶיךָ
The next Posuk says:
לְמַעַן יִרְבּוּ יְמֵיכֶם וִימֵי בְנֵיכֶם עַל הָאֲדָמָה
What is the lesson Learnt?
It once happened in Yeruslayim that the Mahril Diskin paid for the Mezuzos to be checked in Yerushlayim. He paid them from the funds of the orphanage (which is under his name until today). He was asked how was he able to do this?
He answered that the Posukim answer your question. I take in the orphans of Yerushlayim whom it costs to support throughout their whole lives. If I pay now to check the Mezuzos and the people will live, it is a worthwhile investment for the orphanage. Therefore, I am paying from the orphanage's funds as an investment for the future.