I presume you meant that boat B hit the finish mark while finishing. If so:

Generally, equipment failure is either the result of poor maintenance, or bad luck. Either way (unless the boats are provided by the venue, in which case the failure could be grounds for redress) the competitor just has eat the score for RET. So, boat A is simply out of luck.

Regarding boat B, she finishes when the first part of her hull, equipment, or crew in normal position crosses the finish line (see the definition of "finish"). However, B is still racing until she clears the finish line and marks (see the definition of "racing"). Since she touched a mark before clearing the finish line, she broke rule 31.1. Boat B could have exonerated herself by doing a turn, returning to the course side of the finish line, and finishing again (see rule 31.2 and the definition of "finish").

One could argue that RC inappropriately scored Boat B "DNF", and should have protested her instead. Technically, B did finish and only the protest committee is empowered to determine that she broke rule 31.1. This sort of thing is pretty common though, and not grounds for redress so it tends to slide.

Regards,
Eric