Section 187B. A company, or any officer, agent or employee thereof, having actual knowledge that the insured under any policy of insurance has paid the premium thereon to the company, or to its agent who issued the policy, or to the duly licensed insurance broker who negotiated it or its continuance or renewal, who cancels or offers or attempts to cancel any such policy, which provides for cancellation by the company upon giving written notice and paying or tendering to the insured a return premium, without paying or tendering to him with said notice the full return premium thereunder according to its terms without any deductions, or who refuses to pay or tender to the insured the full return premium according to its terms without any deductions upon demand after cancellation by the insured of any such policy which provides for cancellation by the insured and for the payment to him of a return premium, or who refuses to pay or tender to the insured the full return premium according to the terms of the policy without any deductions, upon demand after the full return premium has been ascertained, in the case of such a policy which provides for cancellation by the company upon written notice without paying or tendering the return premium until it has been ascertained, or upon demand after cancellation in the case of such a policy which provides for cancellation by the company upon giving written notice and for the payment of the return premium upon demand after cancellation, shall be punished for the first offence by a fine of not less than fifty nor more than two hundred dollars and for each subsequent offence by a fine of not less than one hundred nor more than five hundred dollars and by imprisonment for not more than six months. An insurance agent may offset funds due an insured for return premiums on any policy against amounts due him from the same insured for any due and unpaid premiums on any other policy issued by the same insurer. An insurer may pay return premiums to any agent for such purpose. An insurer whose return premiums are used by an insurance agent to offset funds due him shall be held to have discharged its obligations to its insured for such return premiums. This section shall not invalidate an assignment of return premium made concurrently with policy insurance as security for financing such premium, nor the right of the assignee, or his assign, to enforce such assignment as a prior claim.