First line AHL players are offensive players who, for a variety of reasons, can't put it together in the NHL. They skate a bit too slow, their stick-handling isn't quite good enough, poor shot selection, think the game a few steps too slow, etc. Still some of the better players in the world but not quite enough to translate to the NHL. But they are primarily offensive players who likely have some holes in their defensive game. They can score on AHL-level goalies, and take advantage of AHL-level defenses. In the NHL they can maybe put up 20-30 points, tops, and have little to contribute on defense.
An NHL 4th liner may or may not be a great offensive player, even in the AHL. But they have more consistent effort, better defensive skills, can skate better, or some other package of things that gives them enough NHL-level talent to stick. In a vacuum they may look objectively worse than an AHL first liner, but they have some skill or subset of skills that makes them succeed at something that is valuable in the NHL whereas the AHL guy just doesn't have it.
Look at Jason Krog. He was pretty much a PPG player in the AHL. Averaged like 50+ assists a season down there at his peak, and scored a decent amount of goals as well. He managed to get 200 NHL games with various clubs, and wasn't particularly good. Averaged 24 points per season, and I don't believe he played much (if any) special teams. He was a stopgap player at best.