Good question, there has been a lot of thinking and designing in thew way this works.
First of all why do we distribute markup?
We distribute markup because the PC/PS items in your quotes do not print with markup, hence the markup has to be moved elsewhere to allow the same amount of markup to be added to the quote. In a nutshell this occurs because we itemise PC/PS items to the client and, we can't then later turn around and show them a different figure (with markup) for the same item, we have to be consistent. See the image below for more.
OK great, so how do you weight the markup
We weight the markup (this is the same whether based on the items in a category or the categories in an estimate) based on the original value of the line item. This means that if you have $100 of markup to distribute and you have a $1 item, and a $99 item, you DO NOT end up with $50 on each, that would be misldeading.
In the example below, Item 2 gets twice as much distributed markup as Item 1 because Item 2 was entered at $200 whereas Item 1 was $100.
So in summary we weight markup by removing it from PC/PS items and adding it to normal items based on the original value of the item. The point of doing so is to make sure the values of the quote still reflect the distribution of cost correctly even after adding the extra markup.