Section 18. A society shall invest its funds in securities permitted by chapter 175 for the investment of the capital of insurance companies, except that it may invest an amount not exceeding 10 per cent of its funds in the shares of federal savings and loan associations located in the commonwealth, and in addition, invest and deposit in paid-up shares and accounts of and in co-operative banks chartered by the commonwealth, and may deposit any of its funds in any savings bank or savings department of a trust company, chartered under the laws of the commonwealth. A foreign society permitted or seeking to do business in the commonwealth may invest its funds in accordance with the laws of the state where it is incorporated, but a part of such funds, not exceeding 20 per cent of its death fund, may be invested in a building for use and occupation by the society as its home office. A society having branches situated in the Dominion of Canada may invest a part of its death fund in the public funds of the Dominion of Canada, or of any province of the Dominion of Canada, not exceeding in the aggregate an amount equal to the sum of its collected premiums for the four months last past.