Section #1: Why are 4-4 fits sometimes better played in 4 of the major, and sometimes better played in 3NT?
Consider this hand:
You should make 5 on this hand: 4 spade tricks, two hearts, one heart ruff, two diamonds, and two clubs. (Whether you take the fourth spade by leading it and discarding a diamond, or by ruffing a diamond, is irrelevant.)
Score: 450
Now look at what happens if you bid 3NT on the hand. We will assume for the time being that West leads a club, a favorable lead for you. Even with this favorable lead, you get three clubs, two diamonds, two hearts, and four spades, making 4.
Score: 430. If everybody else is in 4 spades, you might as well be down 5 doubled at matchpoints. You get a zero.
Why? Four hearts scores an extra trick because you get a ruff. Your four hearts produce 5 tricks instead of 4. If you don't understand this completely, run through the two different contracts and the score you get until you see it clearly.
Now let's take out the doubletons and see what happens:
Here you take only ten tricks: Four hearts, three spades, one diamond, two clubs. Score: 420
If, instead, you play this hand in 3NT, you will score the same ten tricks. Score: 430
Again, if you are in 3NT and everybody else is in 4H, you will get a flat top. If you play in 4H while everybody else is in 3NT, you might as well be -1500 as +420.
The difference is that you cannot get a ruff in either hand. This is the basic economics of major suit contracts as opposed to no-trump contracts at matchpoints. (There are other factors, most significantly safety and stoppers, but this principle needs to be understood.)
Section #2: Stayman
One practical application of this principle is in using Stayman. If your partner opens 1NT and you have a 4-3-3-3 shape and say 10 HCP, you know that your hand is not going to provide an extra trick by means of a ruff. Many experts will not use Stayman at all when they don't have a short suit. The possibility that the NT opener might have your 4-card major and a doubleton that will provide an extra trick via a ruff is offset by the additional information given to the opponents.
There is clearly a risk either way, as it is impossible to cover every circumstance. As a 1NT opener, you might decide to choose 3NT over 4 of a major if your shape is 4-3-3-3 and you are given a choice.
I should also point out that, in general, if you have good HCP for the level of the contract (say, 27-28 for a game contract), no-trump is safer, especially in 4-4 fits. You don't have to worry about opponent ruffs, and bad trump splits are not nearly as big a problem. At NT, an opponent holding 10xxx in your 4-4 suit is no issue; at a trump contract, it could be a big problem.
Section #3: 5-3 major fits.
Here again, I'm only looking at cases where both contracts are safe; there are considerations of safety, such as having adequate stoppers at NT.
Unlike 4-4 fits, you get your extra trick in a 5-3 fit almost exclusively from a ruff in the dummy, i.e. a ruff from the hand with three trumps. If dummy does not have a short suit and you have enough stoppers, the hand is going to score +10 in NT. There is no extra trick in the suit contract, and making 4 hearts vs. 4NT, the NT contract is much better. Look for NT when you have at least a single stopper in side suits and a solid main suit, or else a lot of tenace values in side suits. I'll try to make a hand:
This is a 2/1 auction, N using a forcing 1NT to show 6-9 HCP and three spades. Admittedly, South might pass, but let's say he doesn't. The point I want to make is not the bidding, but the fact that I want to play the hand in NT, whether 2NT or 3NT. This is a complex hand and you will have problems and wish you had bid spades if you get a diamond lead from Axxx or Axxxx. But more often than not, you will take the same tricks in NT that you will take in spades, because dummy will not (usually) get a ruff. Sometimes less (as with the Axxx of diamonds example), sometimes more (when the opps find a ruff in 3S).
I've spent enough time on this and I'm not going to fine-tune the hand so that 3NT and 4 spades both make 10 tricks all the time. On the actual hand, I might (over) bid 2NT, partner would bid 3NT, and we'd be in a risky game that would score very well or very badly, depending on the cards and the opponents' play. (We do not open 1NT holding a decent five-card spade suit. Why not? Because Bob Hamman told my partner not to do it!)