Presumably Company A gives the 6% match as a 100% match of your first 6%. Not that this is an important detail, but it does require that you set aside 6% of your salary to receive the match instead of 5% at Company B.
For the monthly 4% match to come out ahead of a yearly 6% the matched funds would have to achieve a 72% return. There might be other factors (like the available funds to invest in and expense ratios and fees, but without knowing any of those, Company A wins the 401(k) contest. When you consider realistic returns, on your investments, the difference on 6% of a $100K salary matched monthly vs. given at the end of year only amounts to a couple hundred dollars. You really don't have to discount it severely just because it comes in a lump sum.
The incentive of an annual lump-sum payout like a bonus ends up looking a little perverse, because once you get the big annual bonus you have to ask yourself whether it's worth putting another year in at that company or whether it's a good time to look around.
The gamble is: will you last the year. If you leave even one day early, then no match for year.
I worked for a company that did something similar. You got part of the match with every contribution, but the rest was deposited 30 days after the end of the fiscal year. The only way you could leave early and get the money was if you retired or if there was a reduction in force. In was amazing to see the number of people who didn't understand this. Some left and then were upset they didn't get the money. Others never even noticed that the match was lower than they expected.
So if company A didn't give you the match if you left a week early, then company A may have the worse deal:
Now in some periods in the middle Company A is a better deal, but it takes more than two years for it to take the lead for good.
For the sake of argument, let's pretend that you have some magical fund that gives you a 25% yield (i.e., for every $1 you put in the fund, you get an additional $0.25 at the end of the year). Let's also pretend that company B, instead of paying the contributions at each paycheck, actually gives you the whole match at the beginning of the year. In order to make the numbers easier to deal with, let's pretend the total salary is $100000.
Company A: Beginning of year, $0 company match. End of year, $6000 company match.Company B: Beginning of year, $4000 company match. End of year, add to that $1000 interest for a total of $5000.
What you see is that by gaining a full year's worth of interest at an unreasonable 25%, you only made an additional $1000 compared to $2000 from company B. Since the interest rate is likely to be much lower (even 10% is high) and since you only get partial-year interest for most of the money (because you don't get that $4000 as a lump sum), company B further behind while company A stays the same.
Conclusion: all else being equal, company B is the worse deal.