Masts are either keel or deck stepped.

Keel Stepped
Keel stepped boats have a mast which goes down through the deck and to a mast step at the keel. This design is the classical way and the most secure way to secure the mast. Masts must dissipate two types of forces: bending and pumping. By letting the mast go through the deck, a keel stepped boat minimizes the deck’s vulnerability. Bending forces distribute over a longer distance from the keel to the deck. Pumping forces have a solider foot, the keel ballast, to negate them.
While the keel stepped mast minimizes deck pressure, the mast must interact with the deck. To further withstand bending forces, keel stepped masts use knees which connect the deck to the mast or tie rods which support the deck by connecting it to the step. Rubber wedges structurally separate the mast and deck around the collar, the area where the mast passes through the deck. The wedges allow the mast to pump up and down slightly without flexing the deck. Because essentially the collar is a hole in the deck, often water seeps by the wedges. Sailors must carefully keep the area cocked or the moisture can rot the deck. Around the mast, builders should avoid using balsa core.
The bilge is another vulnerable area to rot. Bilge water can damage the mast and step. The step should be raised and kept dry.
Deck Stepped
Deck stepped boats have a mast which does not go through the deck. Instead the mast step is right at the deck level. This arrangement is a modern idea that frees up space below and with proper engineering safely secures the mast. To prevent deck damage from the bending and pumping forces, builders install a compression post from the bottom of the mast to the cabin sole. Like a keel stepped mast, this “jack post” transfers forces and limits the moments on the deck. A floor support in the bilge under the post structurally attaches to the keel. This floor support can rot and cause the deck to sink. The owner may tighten the shrouds without realizing the underlying problem.
Conclusion
Masts are either keel or deck stepped. A keel stepped version is traditionally seaworthy while a deck stepped mast frees up room below. With the advanced engineering of today, well built boats can be either keel or deck stepped and have safe rigs.