[verb た-form] + ものだ
たものだ looks back on something that used to happen regularly and no longer does: "used to", "would often". The verb is in the た-form, and the sentence has a ring of nostalgia. The polite form is たものです.
It usually comes with a time in the past – むかし昔, こどものころ子供の頃, わかいころ若い頃, がくせいじだい学生時代 – and often with よく. The memory is the speaker's own, or something they witnessed.
たものだ needs something that happened again and again, or a state that lasted. A single event takes the plain past.
Both can describe a past habit. The plain past just reports it; たものだ adds the speaker's feeling that those days are gone.
These go beyond past habits.
With よく in the sense of "how on earth", たものだ reacts to something done: impressed, or appalled.