BWA's scoring algorithm and output format were written prior to the SAM specification including match and mismatch operators (= and X, respectively) for the CIGAR strings. The M in the CIGAR string only means an "alignment match", which can be further classified as either a match or mismatch. The actual match and mismatch information for these older aligners (BWA and Bowtie2 for example) is encoded in the MD:Z field.
In your example, this read Q1 has a primary alignment (first line, SAM flag 16) and alternative alignment (second line, SAM flag 256).
The primary alignment chosen by BWA-MEM has an MD:Z field of 0G149, indicating a G mismatch at the beginning of the alignment followed by 149 matches. The alignment score is AS:i:149, which likely excludes the G mismatch because it is on the end of the alignment. If I had to guess, this may have been a heuristic strategy implemented in their algorithm to prefer mismatches on the ends of alignments (like soft clipping) over mismatches in the middle of reads, all other things equal. You can see there is an alternative alignment for this read whose score is AS:i:145, which refers to the second alignment you posted (with the 256 SAM flag).
The second line is the alternative alignment and has an MD:Z field of 56A93, indicating 56 matches, an A mismatch, then 93 matches. The alignment score is AS:i:145, which you would get from 149 matches and 1 mismatch (-4).
BWA-MEM is an improvement on the original BWA algorithm and likely contains some of these edge-case heuristics that may not be exactly described in their publication but could be found in their source code. If a BWA developer happens to see this, perhaps they could explain better.
SAM Tag Specifications: https://samtools.github.io/hts-specs/SAMtags.pdf
SAM Specifications: https://samtools.github.io/hts-specs/SAMv1.pdf