Agile Web Development with Rails 6: LineItem

Newbie here trying to learn Ruby on rails with AWDR6. Got a question regarding the LineItem scaffolded as part of Iteration D2: Connecting Products to Carts. What additional value does it provide? Is it just a join table for the many to many relationship between products and carts? But then a has_many association was used instead of has_many: through or has_many_and_belongs to as per docs. I am struggling to understand this bit of the tutorial as I do not get the underlying logic so any help will be highly appreciated